Board index » delphi » Building a component that responds to shortcut keys?

Building a component that responds to shortcut keys?

Hi,

I am trying to build a component based on TCustomPanel, that has a TToolbar
in it with buttons. These buttons are linked to TActions, and these actions
have shortcuts.

When I create the object dynamically, the shortcuts work just fine, but when
I turn the object into a component, place it on a form,and run the
application, I get an error: "A component named MyActionList already
exists".

Has anyone ever created a component that responds to shortcut keys through
TActions?

- daniel

 

Re:Building a component that responds to shortcut keys?


"Daniel Rutten" <n...@junk.com> skrev i melding
news:3b612845@news.attica.net.nz...

Quote
> Hi,

> I am trying to build a component based on TCustomPanel, that has a TToolbar
> in it with buttons. These buttons are linked to TActions, and these actions
> have shortcuts.

> When I create the object dynamically, the shortcuts work just fine, but
when
> I turn the object into a component, place it on a form,and run the
> application, I get an error: "A component named MyActionList already
> exists".

> Has anyone ever created a component that responds to shortcut keys through
> TActions?

It may be a problem with the 'Owner' property:
When you put a component on a form, it's owner is the Form. If you create a
component containing cub-components, do create them with the Form as their
owner. The ActionList only checks for shortcuts in owned components, not in
owned components' components array.
If you name the ActionList in your component, you're not able to create 2 of
them. Or - it may be the 'owner' problem....try *not* to give it a name...

--
Bjoerge Saether
Consultant / Developer
http://www.itte.no
Asker, Norway
bjorge@takethisaway_itte.no (remve the obvious)

Other Threads