Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question about actions 3

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
0
0
US
I have an actionlist component on my form. I have been creating actions for my buttons instead of populating the onclick event. Although most of the actions are only used one time, is there an advantage of using actions instead of coding the onclick event?
Thanks.
 
the power of actions come into play when you are implementing many GUI items that point to the same function.

For example a copy function, you would have a menu item, a toolbar icon and a popup menu item. When you need to disable the function you need to disable the menu item, the toolbar icon and the popup menu item. With actions you just disable the action and the rest is done for you...


/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
To add to this post I always use actions for my applications. Because as whosrdaddy said if you are accessing many of the same functions it would be easier to use one reference to it.

When i create my actions and link them to menu items, toolbar etc it is easier to code, the actions also provide OnUpdate handlers which are good if say you need to disable/enable the action for certain conditions
 
The main reason I use actions is so that I can handle the OnUpdate event. I never have to hard-code any function that disables and enables my buttons, menu items, and toolbar buttons. The "state" of each item depends on the state of other things, whether they're in the UI, the data module, or elsewhere. Yes, the OnUpdate event is called A LOT, but if I keep the code simple, the end user really doesn't know or feel that anything is going on in the background.

GIS Programmer
City of Orem, UT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top