Board index » delphi » Action & shortcut annoyance [D4]

Action & shortcut annoyance [D4]

Hi

One of the things I don't like about action list is that if I assign
shortcut keys to a TAction, it's active even though the form that owns
the action isn't active.  For ex, if I bind alt+k to some action in form
A, and form A create a modal form B, then while B is active, if the user
presses alt+k and it's not bound to anything in form B, the action in
form A is executed.  What I have to do now is this: in form A's
OnDeactivate, I loop through all its actions, save the shortcut keys, and
set all shortcuts to 0.  Then in OnActivate, I have to go through the
actions and restore the shortcuts.

This seems kinda dumb.  Is there a better way?

TIA

--
  luu

 

Re:Action & shortcut annoyance [D4]


Hi !

You could create a descendant of TAction, the ActionList concept is
prepared for this (RegisterAction or similar). Then you could check if
any component having the action with the shortcut assigned is owned by
Active Form.

--
Bjoerge Saether
Consultant / Developer
Asker, Norway
bsaether.removet...@online.no (remove the obvious)

Luu Tran skrev i meldingen
<8E94CA44Dluutrangeocit...@207.126.101.100>...

Quote
>Hi

>One of the things I don't like about action list is that if I assign
>shortcut keys to a TAction, it's active even though the form that owns
>the action isn't active.  For ex, if I bind alt+k to some action in
form
>A, and form A create a modal form B, then while B is active, if the
user
>presses alt+k and it's not bound to anything in form B, the action in
>form A is executed.  What I have to do now is this: in form A's
>OnDeactivate, I loop through all its actions, save the shortcut keys,
and
>set all shortcuts to 0.  Then in OnActivate, I have to go through the
>actions and restore the shortcuts.

>This seems kinda dumb.  Is there a better way?

>TIA

>--
>  luu

Other Threads