Recent

Author Topic: Question about Actions  (Read 2667 times)

Bart

  • Hero Member
  • *****
  • Posts: 5554
    • Bart en Mariska's Webstek
Question about Actions
« on: December 27, 2011, 12:22:54 am »
Hi,

I'm new to the concept of ActionLists and Actions (coming form D3).
Now I have an app which has some actionlists on Form1.
Some of the actions have shortcuts (like Ctrl+V).

I have noticed (unexpectedly for me) that when Form1 shows another form (like a TFindDialog) that when I am in that second form, and  I press Ctrl+V, the action from Form1 gets executed.
This only happens if the second form is opend with Show, not with ShowModal.

Is this behaviour intended (I cannot check with Delphi, my version doesn't have ActionLists)?
I find it rather annoying. In the described scenario, when I want to paste text into the "Find Text" control on the TFindDialog, it doesn't paste text there, but instead it actually pastes text in my editor (in which I tried to search).

I can check the Active propery of Form1 in all the actions OnExecute handlers, but still this steals away normal shortcuts that should work on the second form.

Maybe I am not using the concept of a TActionList properly.

This is how I use it in my app.
I have a toolbar with speedbuttons and a mainmenu and some popup-menu's.
In the past I would write eventhandlers for all buttons and menuitems for the same "action". Now I coupled a TAction (e.g a PasteAction) to the button, end the menu-items, thus centralizing code and not having to worry when I change the caption/hint/shortcut of one menu-item and forgetting the associated speedbutton/popup-menu.
All TActions have a seperate OnExecte eventhandler.
The TActionLists do not have one (do they need one?).

Bart

 

TinyPortal © 2005-2018