Recent

Author Topic: ActionList tutorials and examples?  (Read 12186 times)

IPguy

  • Sr. Member
  • ****
  • Posts: 385
ActionList tutorials and examples?
« on: May 19, 2012, 04:19:06 am »
Are there some good tutorials on using ActionLists?

When should I consider ActionLists and when should I not use them?

Would I (or should I?) use ActionList to handle popupmenu's, where the popupmenus change depending on the underlying data?

If I have both an Action for a tButton and an OnClick event for that same tButton, what happens first - the action or the event?

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: ActionList tutorials and examples?
« Reply #1 on: May 19, 2012, 08:38:28 am »
From the horses mouth:
http://edn.embarcadero.com/article/27058
http://www.drbob42.com/delphi4/actions.htm

Quote
When should I consider ActionLists and when should I not use them?
They are interesting if several controls end up doing the same action and if you want to share properties such as caption, enabled, hint, helpindex,... among these controls. fe: disabling an action disables all controls using that action.
If you just want to perform the same OnClick and are not interested in sharing properties you could as well use common OnClick event handlers.
Quote
If I have both an Action for a tButton and an OnClick event for that same tButton, what happens first - the action or the event?
It is one or the other. Setting an action clears the onclick. If the onclick is set afterwards, it'll do the onclick only.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: ActionList tutorials and examples?
« Reply #2 on: May 19, 2012, 10:40:48 am »
Quote
When should I consider ActionLists and when should I not use them?
For me, if you have a thought that someday you'll have at least two controls for the same purpose but not necessarily different way (e.g. TMainMenu and TToolbar), use it.
Quote
Would I (or should I?) use ActionList to handle popupmenu's, where the popupmenus change depending on the underlying data?
Yes if the popupmenu functionalities and properties are shared with other controls like the main menu.
Quote
If I have both an Action for a tButton and an OnClick event for that same tButton, what happens first - the action or the event?
If you assign from the object inspector, setting one would clear the other AFAIK.

IPguy

  • Sr. Member
  • ****
  • Posts: 385
Re: ActionList tutorials and examples?
« Reply #3 on: May 20, 2012, 06:08:40 am »
Thanks for the reference information.

re:
Quote
If I have both an Action for a tButton and an OnClick event for that same tButton, what happens first - the action or the event?
Quote
If you assign from the object inspector, setting one would clear the other AFAIK.
Testing that with a button (see the attached image from the button OI), I find that both the Action and the event can co-exist.
If I have the event in place, it fires.  If I remove the Event, the Action fires.

Laz 1.1-36568-2.6.1-win32-Vista

 

TinyPortal © 2005-2018