Home   Help Search Login Register  

Author Topic: UI Events  (Read 1008 times)

0 Members and 1 Guest are viewing this topic.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
UI Events
« 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.
Xbox Rocks

Offline i0n0s

  • Former Staff
  • ****
Re: UI Events
« Reply #1 on: 12 Feb 2009, 02:10:57 »
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.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: UI Events
« Reply #2 on: 12 Feb 2009, 02:15:53 »
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 article it is instead listed on the dialog page as a property.
Xbox Rocks

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: UI Events
« Reply #3 on: 12 Feb 2009, 10:09:57 »
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...).
« Last Edit: 12 Feb 2009, 10:11:37 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)