Delphi 2010 Ribbon Demo - how are the Clipboard commands (Paste, Cut, Copy, Delete) linked to the RichEdit?

Subject: Delphi 2010 Ribbon Demo - how are the Clipboard commands
(Paste, Cut, Copy, Delete) linked to the RichEdit?

In the Delphi 2010 Ribbon Demo project, I cannot find the way in which
the Cut, Copy and Paste commands are linked to the RichEdit.

I checked all the properties of the ActionManager as well as the code
in the RibbonDemoMainForm.pas unit, but cannot see where it is linked.

How does the Cut, Copy and Paste command buttons on the ribbon
automatically activate and deactivate when the cursor is in the
RichEdit?

What are the steps required to establish the link?


Thanks in advance for any inputs.

-- 
Regards,
-Steve Faleiro-
0
Steve
5/17/2010 11:53:31 AM
embarcadero.delphi.vcl.using 2297 articles. 2 followers. Follow

2 Replies
1337 Views

Similar Articles

[PageSpeed] 37

> In the Delphi 2010 Ribbon Demo project, I cannot find the way in which
> the Cut, Copy and Paste commands are linked to the RichEdit.

Roughly speaking, when a VCL application goes idle, the actions of the
active form get asked to update themselves. In the case of an action
that you define the behaviour of youself, this means its OnUpdate event
is raised. An action, however, can be 'prebuilt', as in the case of the
rich edit ones. All the rich edit actions have to do to take on the
appearance of being 'linked' to a client control, then, is to check the
active control type when told to update themselves, and enable or
disable themselves appropriately in light of this.

None of this is specific to the VCL ribbon by the way. If you're
wondering, you can add a prebuilt action at design time by opening up
the action list/action manager editor, clicking for the 'new action'
toolbar button's dropdown menu, and selecting 'New standard action...'.
You can also create and register your own prebuilt actions, though that
takes a little work (it is easier to just add any custom prebuilt
actions at runtime).
0
Chris
5/17/2010 5:10:54 PM
> {quote:title=Steve Faleiro wrote:}{quote}
> Subject: Delphi 2010 Ribbon Demo - how are the Clipboard commands
> (Paste, Cut, Copy, Delete) linked to the RichEdit?
> 
> In the Delphi 2010 Ribbon Demo project, I cannot find the way in which
> the Cut, Copy and Paste commands are linked to the RichEdit.

By the ActionManager, as you'd expect. 

> I checked all the properties of the ActionManager as well as the code
> in the RibbonDemoMainForm.pas unit, but cannot see where it is linked.

Just choose the Home tab in the ribbon, and then click once on the Delete button. You'll see, in the Object Inspector, that selects TActionClients[3], which has an Action of EditDelete1. EditDelete1 can be found in the ActionManager1.

Now comes the trickery. <g> TEditDelete is a descendant of TEditAction, and TEditDelete.ExecuteAction contains this:

{code}
procedure TEditDelete.ExecuteTarget(Target: TObject);
begin
  GetControl(Target).ClearSelection;
end;
{code}

GetControl is defined in the ancestor, TEditAction. Guess what it does? If you guessed "finds the memo or richedit the EditAction has been assigned to", you're a winner. <g>

{code}
function TEditAction.GetControl(Target: Object): TCustomEdit;
begin
  Result := Target as TCustomEdit;
end;
{code}

> How does the Cut, Copy and Paste command buttons on the ribbon
> automatically activate and deactivate when the cursor is in the
> RichEdit?

Because TRichEdit is a TCustomEdit descendant, and therefore TEditDelete (through it's ancestor, TEditAction) figures it out for you.

> What are the steps required to establish the link?

Drop a TRichEdit on a form, along with a TActionManager. In the Action Manager, choose the New Action|New Standard Action, and create any or all of the Edit actions by dragging them to the leftmost pane of the action editor.

Drop a TRibbon on your form. Assign the ActionManager to the ribbon, then right-click the ribbon and choose "New Tab". Right click that new tab and choose "New Group". Drag and drop any of the Action Manager's actions to the RibbonGroup. You're done. <g>

Run your app, and you'll notice that most (if not all) of the items in that RibbonGroup are disabled (I actually had text in the clipboard, so the "Paste" was enabled).

Click in the RichEdit, and type some text, and then select some. You'll see the Cut/Copy/Delete items in the RibbonGroup are automatically enabled.

It's actually the "magic" of the standard actions; the Delphi developers did a great job when they set up the standard actions and gave them their basic functionality. The ability to automatically link to the TMemo or TRichEdit that has the focus is one of those nice things.
0
Ken
5/17/2010 5:29:02 PM
Reply:

Similar Artilces:

Using Delphi 7 and Delphi 2010
I had a project in Delphi 7. I worked on it in Delphi 2010. When I try to open the .dpr again in Delphi 7, the IDE toolbar widens across both monitors, and Delphi 7 locks up. It appears that Delphi 2010 modifies the .dpr in a way that makes Delphi 7 unable to open it again. All my forms & units appear to open fine in D7 after D2010, except for the warnings on the ExplicitHeight and ExplicitWidth properties being missing... I can easily recreate the .dpr, but is this expected behavior? Thanks. Tom Field wrote: > I had a project in Delphi 7. > > I worked o...

Spreadsheet component for use in Delphi VCL 2010
Good day I have been using the Flexcel component for reading and writing Excel spreadsheets in my Delphi VCL projects for some while and have been very happy. Unfortunately, though, a version for use with Excel 2007 format files (.XLSX) has been promised for years now but just never arrives and I have reached a stage where I just have to update some of my software. Can any body suggest alternatives and comment on their experience with these? I have no objection to buying a component although all my programs are for academic use by myself and colleagues/friends so cheaper would...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

Delphi 2010 IDE Block text copy/paste
Hi I have been searching which hot key let you cut and past a block of text (NOT A BLOCK OF LINE) I have found out painfully how to highlight it (aka select it) with <ctrl><Alt> <mouse down> but after ??? it is a very time saving feature actually fundamental but I was too blind to find it or it is not very well documented and the help being what it is.... any ideas ? Thank you PW "Philippe Watel" wrote in message news:236134@forums.embarcadero.com... > Hi > I have been searching which hot key let you cut and past a block of text > (NOT A BLOCK...

FireDAC installation
My company's currently using Delphi 2010 (Professional), and we're very tempted by the current upgrade offer to take us to Delphi XE5. While our internal release cycles mean we're likely to put off the actual upgrade to XE5, we could make use of the FireDAC system in the near future and as far as I can tell from the feature matrix this +is+ bundled with XE5 Pro. So, as the offer means the upgrade to XE5 is only slightly more expensive than the FireDAC package in isolation, does anyone know if it's possible to install/use the FireDAC bundled with XE5 on our 2010 installati...

Price of upgrade from Delphi 2010 Professional to Delphi 2010 Enterprise?
It's weird, but I could not find the answer on so simple question not in Embarcadero Shop, neither by the forum search. For example, the shop info about Enterprise upgrade says: The Upgrade product is available to registered owners of 2006-2009 versions, blah-blah... So, if I'm Delphi 2010 Professional user, I even not eligible for upgrade? I have to buy a new version of Enterprise??? But if I'm Delphi 2006 Professional user, I can upgrade. Please clarify this nonsense for me. Exact question is in the subject. Thanks! Hi Dmitri, > It's weird, but I could not...

Delphi 2010 professional to Delphi XE3
Hello, Sorry for this is not right place to ask this question: I have Delphi 2010 professional version, I like to upgrade to Delphi XE3 Am eligible to upgrade or no not? I like answer from Delphi sales team. I couldn’t find email to ask them. Thanks Mike Thomas <> wrote in news:506459@forums.embarcadero.com: > Hello, > > Sorry for this is not right place to ask this question: > I have Delphi 2010 professional version, I like to upgrade to Delphi > XE3 Am eligible to upgrade or no not? I like answer from Delphi > sales team. I couldn’t find emai...

Migrating From Delphi 7 to Delphi 2010
We did not know which forum was the best for this question. We have been wanting to migrate from Delphi 7 to a later version for years but it appears to be a daunting task. We first looked at D2006 and that was a radical new world. We bought D2010 a couple of years ago and not done much with it because there are so many parts to our applications. We have done a few new applications in D2010 and they seem to work okay. D2010 has not been impressive, perhaps because of the strangeness compared to D7. Is is possible for us to do a phased sort of migration where we do a form at a time? ...

Delphi 2010 w Delphi 2007
I have D2007 installed on my laptop (XP sp3 running on dual core Athlon). Can I install D2010 on this machine without it affecting D2007? Will D2010 affect D2007 in any way? Thanks, Randall Carpenter > {quote:title=Randall Carpenter wrote:}{quote} > I have D2007 installed on my laptop (XP sp3 running on dual core Athlon). > Can I install D2010 on this machine without it affecting D2007? Will D2010 > affect D2007 in any way? Won't hurt a thing. I have D7, RAD Studio 2007, RAD Studio 2009, and RAD Studio 2010 all on my desktop system and they coexist fine. Jus...

delphi 2006 code in delphi 2010
hello, is there any option to make delphi 2006 code work in delphi 2010? something like in java IDEs where you can define the code level you like to use? the problem is, that i made a project with 2006 and sent it to my customer. they got 2010 and it compiles fine, but it just doesn't work. it deals with en-/decryption of text, we assumed, that it has something to do with ansi vs. unicode strings... but we cant find the exact position where the error occurs. i am a bit dissapointed, because everywhere i read that the new IDE will always be downwards compatible and so on.. but in ...

Migrate from Delphi 2007 to Delphi 2010
Hi All, Thanks in advance for your help. Below is my query, Currently I am using Delphi 2007 and i want to migrate to Delphi 2010. 1. What all things i need to take care while doing this? 2. What all third party components will get impacted? 3. Any known issues in Delphi 2010 which might impact the cause? 4. Any changes in database operation required as i am using Oracle? Hope I have post this query under correct category. If not sorry for the trouble and could you please suggest me the correct category for this? Looking forward for your response. Have a great day. Th...

Free RAD Studio 2010 and Delphi Prism 2011 with purchase of Delphi 2010
Hi All, For those of you who complain that Delphi (and RAD Studio) is too expensive... for a few short weeks there are two overlapping special offers from Embarcadero that you can use to move up to RAD Studio 2010 including the latest Delphi Prism 2011 for the price of a single Delphi 2010 (New User or Upgrade)... The first "RAD Studio PROMO" offer is still valid until June 28th: when you order Delphi 2010, you get RAD Studio 2010 delivered instead (including Delphi 2010, C++Builder 2010 and Delphi Prism 2010). As of May 26th, the "Delphi Prism 2011" of...

Delphi 6 and Delphi 2010 Install same machine
I'm currently still on Delphi 6 for some legacy software, but I'm looking at installing Delphi 2010 on my Windows XP machine. Are there any known issues with installing D2010 on an XP machine that already has Delphi 6 installed? (I'm not talking about updating the projects code/controls/etc, just running the IDE's). > I'm currently still on Delphi 6 for some legacy software, but I'm > looking at installing Delphi 2010 on my Windows XP machine. > > Are there any known issues with installing D2010 on an XP machine that > already has Delphi 6 i...

Web resources about - Delphi 2010 Ribbon Demo - how are the Clipboard commands (Paste, Cut, Copy, Delete) linked to the RichEdit? - embarcadero.delphi.vcl.using

Clipboard - Wikipedia, the free encyclopedia
A clipboard is a thin, rigid board with a clip at the top for holding paper in place. A clipboard is typically used to support paper with one ...

Mac App Store - Clipr - A tiny cloud powered clipboard manager
Get Clipr - A tiny cloud powered clipboard manager on the Mac App Store. See screenshots and ratings, and read customer reviews.

Box of Clipboards - Flickr - Photo Sharing!
Sitting on the floor after we got done surveying.

Clip Stack: A Clipboard Your Phone Needs – XDA App Review - YouTube
and millions of cat videos. Smartphones have brought friends and family closer. Find something funny, adorable, or twisted that your friends ...

New from Google: Paid web apps, drawings in web clipboard, latest breathtaking 45° imagery in Maps
Stunning 45-degree views are now available in Maps for more places in the US and abroad. Never content with resting on its laurels, Google have ...

Review: Paste, a simple, effective and pretty clipboard manager for the Mac
... it – then you get distracted and copy something else before you get the chance. You then have to find and copy the first item again. A clipboard ...

Salesforce Acquires Bookmarking Startup Clipboard for More than $10M
Salesforce has acquired Clipboard , a social bookmarking service that had built interesting hooks for saving rich web content across devices, ...

Native Clipboard Is A Clipboard Manager With A Floating Window UI And Extra Functionality For Xposed ...
Copying and pasting is better than it used to be on Android, but it still isn't ideal - just like Windows, you can only keep one bit of text ...

Are You Into Clipping Stuff From The Internet? Then You’ll Want Clipboard.com’s New App
Clipboard for clipboard.com (Free) by Clipboard Inc allows you to get the simple functionality of the clipboard.com service on your iPhone. For ...

Clipbor is a very configurable clipboard manager
If you’re frustrated by the Windows clipboard and its one item limit then you’ve probably already tried a few clipboard managers, and we’ve covered ...

Resources last updated: 1/21/2016 6:14:19 PM