OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: hoz on 12 Feb 2009, 01:59:29
-
When should someone use the control property action = "some function"; and when is an appropriate time to use Onbuttonclick = "some function" ? they both do the same thing.
One guess is that action maybe more universal. for instance hitting the enter hit in place of a click. Any other reasons?
I noticed last night that I was inheriting from a button which had the control property action = "some function", in the new button I just used Onbuttonclick "new function" but I hadn't created the function yet. The result was that the onbuttonclick function wasn't reporting an error and the action entry was taking over.
Weird.
-
Myself didn't had any success when I tried OnButtonClick, but it has the advantage, that it passes the ctrl (and the dialog) to the function and you don't need to find the dialog yourself.
-
I'm using it and if your combining it with action="" then perhaps action has a higher priority then OnbuttonClick but I would tend to think it would have a lesser priority. Action isn't listed in the UI Event Handlers (http://community.bistudio.com/wiki/User_Interface_Event_Handlers) article it is instead listed on the dialog page as a property.
-
onButton* works on any control that capture general mouse events, such as map controls. action is specifically for button type controls and should be what you use for buttons, if only because then you can use ctrlActivate to force the button pressed via a script (not saying you want to use ctrlActivate, but...).