A.Cyprus 16 Posted November 13, 2014 Hello chaps I'd appreciate some advice, as trial and error is yielding no results. The example code below describes a simple dialog, which I would like to: be draggable when open execute some code / call a function when the user double clicks anywhere on it I am having trouble getting this simple setup to work, I'm not sure whether it's my approach or whether something is broken. The dimensions and colours etc are arbitrary, I am just interested in behaviour for now. config.cpp: class RscText; class Cyp_Dialog { idd = -1; movingEnable = 1; enableSimulation = 1; class controlsBackground { class Cyp_Dialog_Bg: RscText { idc = 10; moving = 1; x = 0.5 * safezoneW + safezoneX; y = 0.5 * safezoneH + safezoneY; w = 0.05 * safezoneW; h = 0.05 * safezoneH; colorBackground[] = { 0.5, 0.5, 0.5, 1 }; colorText[] = { 1, 1, 1, 1 }; onMouseButtonDblClick = "systemChat 'bg dbl'"; sizeEx = 0.04; text = "Click Me"; }; }; }; Using the config above, I can createDialog and drag it around in-game but the double-click handler doesn't seem to fire. If I enable the control via onLoad, the double-click handler fires and prints to systemChat, but the dialog itself is no longer draggable. config.cpp: class RscText; class Cyp_Dialog { idd = -1; onLoad = "((_this select 0) displayCtrl 10) ctrlEnable true"; movingEnable = 1; enableSimulation = 1; class controlsBackground { class Cyp_Dialog_Bg: RscText { idc = 10; moving = 1; x = 0.5 * safezoneW + safezoneX; y = 0.5 * safezoneH + safezoneY; w = 0.05 * safezoneW; h = 0.05 * safezoneH; colorBackground[] = { 0.5, 0.5, 0.5, 1 }; colorText[] = { 1, 1, 1, 1 }; onMouseButtonDblClick = "systemChat 'bg dbl'"; sizeEx = 0.04; text = "Click Me"; }; }; }; I have read through the BIKI pages on Dialogs and UI Event Handlers, and have searched the forums. I am also familiar with this ticket which is similar but not entirely applicable. After lots of trial and error, my next step would be to manually ctrlSetEventHandler outside of the config, but I thought I would ask here first: Should I expect onMouseButtonDblClick to work as above? Is onMouseButtonDblClick mutually exclusive with dragging by design? Could this issue be related to RscText control in particular? Is onMouseButtonDblClick broken somehow? Is there a more 'proper' approach? Many thanks. ---------- Post added at 19:44 ---------- Previous post was at 19:32 ---------- As a quick afterthought, I added a new RscText to class controls[], set moving=1. I was able to drag the dialog using this control, and fire the response by double-clicking on the background control - but only as long as they were not overlapping (ie, position and dimensions matching). Share this post Link to post Share on other sites
.kju 3245 Posted November 13, 2014 try using class Controls instead of class controlsBackground or is there a particular reason for that? also check the A3 AIO config/A3ui configs for examples with onMouseButtonDblClick Share this post Link to post Share on other sites
A.Cyprus 16 Posted November 14, 2014 ;2818635']try using class Controls instead of class controlsBackground or is there a particular reason for that? Not as such. It started off more complex with stuff in both class controlsBackground and class controls but I ended up gradually stripping everything out to eliminate any potential causes for it not working. I've tried using items exclusively in either controlsBackground or controls' date=' and I've tried using items in both at the same time. All scenarios yield the same observations in my opening post. Further to that, I've just tried the following configs and included the results alongside them: [b']Settings:[/b] - moving=1 - ctrlEnable true Results: - Dragging: fails - onMouseButtonDblClick: works Settings: - moving=1 - ctrlEnable false Results: - Dragging: works - onMouseButtonDblClick: fails Settings: - moving=0 - ctrlEnable true Results: - Dragging: fails - onMouseButtonDblClick: works Settings: - moving=0 - ctrlEnable false Results: - Dragging: fails - onMouseButtonDblClick: fails ;2818635']also check the A3 AIO config/A3ui configs for examples with onMouseButtonDblClick Do you mean the config in ui_f? Thanks for replying. Share this post Link to post Share on other sites