User Interface Event Handlers – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search

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)


Does anybody know if onLoad is also a supported parameter for controls in OFP and Arma 2? Arma 3 supports onLoad and presumably onUnload for Controls, but I am unsure if this is also the case for previous titles. --Tryteyker- (talk) 18:07, 7 May 2016 (CEST)

onJoystickButton

onJoystickButton

  • Priority: 3
  • Use on: Control
  • Fired on: Pressing and releasing any joystick button.
  • Returns: Returns the control and the the pressed button.
private ["_control", "_button"];
_control = _this select 0;
_button = _this select 1;
Present only in Armed Assault.