User Interface Event Handlers – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(Answered "onDraw" event handler question)
Line 26: Line 26:


Checkout my example for [[drawLine]]. - [[User:Waffle SS.|Waffle SS.]]
Checkout my example for [[drawLine]]. - [[User:Waffle SS.|Waffle SS.]]
== Tree event handler returns incorrect regarding Arma 3 ==
I have noticed that the event handlers relating to tree controls have incorrect returns in the documentation. I tested a bunch of them and here are my findings:
onTreeSelChanged - Returns control and path of selection that was changed<br>
onTreeLButtonDown - Returns control and path of selection that was clicked<br>
onTreeDblClick - Returns control and path of selection that was double-clicked.
onTreeExpanded - Returns control and path of selection that was changed<br>
onTreeCollapsed - Returns control and path of selection that was changed<br>
Additionally, if multiple event handlers are in effect, all will fire if their conditions are met. eg. "onTreeDblClick" will also trigger "onTreeExpanded/Collapsed", and "onTreeDblClick" will result in "onTreeLButtonDown" twice. This is not specific to event handlers that affect trees. The previously listed event handlers will also fire when using "onMouseButtonDown/Up/Click/DblClick"
I know this wiki supports more than just A3 so I have not directly changed this article, as I am unsure of the standard operating procedure regarding this. I also lack the willpower necessary to open A2, create a tree, and test the return types, and I don't own OFP. - [[User:DreadedEntity|DreadedEntity]] ([[User talk:DreadedEntity|talk]]) 04:44, 10 February 2015 (CET)

Revision as of 05:44, 10 February 2015

The values returned by the "onMouseMoving" event of a display are most probably not "some kind of x and y delta position" but rotation angles. Treating these values as azimuth and elevation and applying them to, let's say, a camera results in a perfectly smooth camera movement:

mycam = "camera" camCreate (player modelToWorld [0, -5, 3]);
mycam setDir getDir player;
mycam cameraEffect ["INTERNAL", "BACK"];
showCinemaBorder false;
ax = 0;
ay = getDir player;
myhandler = '
  ax = ax + (_this select 2);
  ay = ay + (_this select 1);
  _cx = cos -ax; _cy = cos -ay;
  _sx = sin -ax; _sy = sin -ay;
  mycam setVectorDirAndUp [
    [_cx * -_sy,  _cx * _cy, _sx],
    [_sx *  _sy, -_sx * _cy, _cx]
  ];
';
(findDisplay 46) displayAddEventHandler ["MouseMoving", myhandler];

Worldeater 20:55, 10 October 2010 (CEST)


How do you use the "onDraw" event? Also, how would one go about learning more about these? Are the code/commands in the config viewer somewhere? (A3) - DreadedEntity


Checkout my example for drawLine. - Waffle SS.

Tree event handler returns incorrect regarding Arma 3

I have noticed that the event handlers relating to tree controls have incorrect returns in the documentation. I tested a bunch of them and here are my findings:

onTreeSelChanged - Returns control and path of selection that was changed
onTreeLButtonDown - Returns control and path of selection that was clicked
onTreeDblClick - Returns control and path of selection that was double-clicked. onTreeExpanded - Returns control and path of selection that was changed
onTreeCollapsed - Returns control and path of selection that was changed

Additionally, if multiple event handlers are in effect, all will fire if their conditions are met. eg. "onTreeDblClick" will also trigger "onTreeExpanded/Collapsed", and "onTreeDblClick" will result in "onTreeLButtonDown" twice. This is not specific to event handlers that affect trees. The previously listed event handlers will also fire when using "onMouseButtonDown/Up/Click/DblClick"

I know this wiki supports more than just A3 so I have not directly changed this article, as I am unsure of the standard operating procedure regarding this. I also lack the willpower necessary to open A2, create a tree, and test the return types, and I don't own OFP. - DreadedEntity (talk) 04:44, 10 February 2015 (CET)