displaySetEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Added category: [Command Group: GUI Control])
No edit summary
Line 9: Line 9:
| Sets given event handler of given display.
| Sets given event handler of given display.


The provided function should return true/false indicating that the event has handled this event fully or not and whether the engine should execute it's default code or not afterwards.  
The provided function should return true/false indicating that this event was handled and whether the engine should execute it's default code afterwards.  


See [[User_Interface_Event_Handlers|User Interface Event Handlers]] for the full list of handler names.
See [[User_Interface_Event_Handlers|User Interface Event Handlers]] for the full list of handler names.

Revision as of 13:47, 15 January 2010

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Sets given event handler of given display. The provided function should return true/false indicating that this event was handled and whether the engine should execute it's default code afterwards. See User Interface Event Handlers for the full list of handler names. If applicable, see DIK_KeyCodes for a list of key code constants, which are relevant to key related user interface events like: KeyDown & KeyUp.
Groups:
Uncategorised

Syntax

Syntax:
display displaySetEventHandler [handlerName, function]
Parameters:
display: Display
[handlerName, function]: Array
handlerName: String
function: String. {Code}
Return Value:
Nothing

Examples

Example 1:
_control displaySetEventHandler ["KeyDown", ""] 
Example 2:
init.sqf

keyspressed = compile preprocessFile "keyspressed.sqf"; _display = findDisplay 46; _display displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressed.sqf
private['_handled'];
_handled = false;
switch (_this select 1) do
{
	//F key
	case 33: 
	{
		// code here
		_handled = true;
	};
};
_handled;

Additional Information

See also:
ListOfKeyCodesdisplayAddEventHandlerdisplayRemoveEventHandlerdisplayRemoveAllEventHandlersctrlSetEventHandlerUI Event HandlersDIK KeyCodeskeyName

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on Nov 25, 2009
kju
Always use displayAddEventHandler instead, as DSetEH overwrites other (peoples') DEH.

Bottom Section