alleycat 28 Posted September 1, 2014 I would like to attach eventhandlers to a dialog, not a display. For displays I use: (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this execVM script.sqf'"]; which fires a script when the left mouse is pressed. But how to do that for a dialog? https://resources.bisimulations.com/w/index.php?title=ctrlAddEventHandler This looks useful but I do not know how to reference the control it should point to. How would I fix that? Share this post Link to post Share on other sites
SilentSpike 84 Posted September 1, 2014 You can't add a MouseButtonDown EH to a display, only a control. Little confused because a dialog is a display. Share this post Link to post Share on other sites
alleycat 28 Posted September 1, 2014 (edited) Not sure what you mean. (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this execVM script.sqf'"]; This will fire the script whenever the player presses the mouse in regular first person (which is display 46). However I would like to have that functionality in a dialog (mouse moving around on screen + buttons to click are present). disableSerialization; CreateDialog "cat_ui_corpse"; ctrlSetText [1001, "text"]; ; This will display a dialog with mouse control and some buttons. However how to place an evenhandler for mouse clicks into this? (_display displayCtrl 5000) ctrlSetEventHandler ["MouseButtonDown", "_this execVM script.sqf']; Does not work Edited September 1, 2014 by alleycat Share this post Link to post Share on other sites
SilentSpike 84 Posted September 1, 2014 (edited) Huh, must be new in A3 or something Apparently the Biki page on ctrlEventHandlers is just showing information from Armed Assault. Well since it looks like you're using a custom display, just put: onMouseButtonDown = "_this execVM 'script.sqf'"; into the display class. You can also do things like use onLoad to add EH's or save the display into a variable for later use. However findDisplay should work fine if using createDialog, so long as your display has a hardcoded idd. Edited September 1, 2014 by SilentSpike Share this post Link to post Share on other sites