ctrlCreate – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 7: Line 7:
Also, if the control is being created in a display that is not the active display, it will not be shown.<br>
Also, if the control is being created in a display that is not the active display, it will not be shown.<br>
One more edit before I have to leave because this is really funny, while testing the above statement, I was creating controls on various displays, and I created one on the main menu which did not show up until leaving the editor. -[[User:DreadedEntity|DreadedEntity]] ([[User talk:DreadedEntity|talk]]) 22:12, 6 February 2016 (CET)
One more edit before I have to leave because this is really funny, while testing the above statement, I was creating controls on various displays, and I created one on the main menu which did not show up until leaving the editor. -[[User:DreadedEntity|DreadedEntity]] ([[User talk:DreadedEntity|talk]]) 22:12, 6 February 2016 (CET)
:: The display is closed because the button has IDC set to 2, which is reserved by engine. 1 is used by OK buttons and 2 by Cancel buttons. If you use any other number, the display won't be closed. ++[[User:Str|Str]] ([[User talk:Str|talk]]) 09:01, 9 February 2016 (CET)

Revision as of 09:01, 9 February 2016

I have found that the button closes after an "OnMouseButtonUp" event, however ctrlRemoveAllEventHandlers does not work in removing it, and ctrlRemoveEventHandler cannot be used due to not knowing the id# for the event.
However, interestingly, you can set a "MouseButtonDown" event through code (ctrlSetEventHandler or ctrlAddEventHandler) and disable the control (ctrlEnable), preventing the MouseButtonUp event from firing, but giving the appearance
of being clicked.
_ctrl = (findDisplay 12345) ctrlCreate ["RscButtonMenu", 2]; _ctrl ctrlSetText "Button"; _ctrl ctrlSetEventHandler ["MouseButtonDown", "(_this select 0) ctrlEnable false"];
Also, if the control is being created in a display that is not the active display, it will not be shown.
One more edit before I have to leave because this is really funny, while testing the above statement, I was creating controls on various displays, and I created one on the main menu which did not show up until leaving the editor. -DreadedEntity (talk) 22:12, 6 February 2016 (CET)

The display is closed because the button has IDC set to 2, which is reserved by engine. 1 is used by OK buttons and 2 by Cancel buttons. If you use any other number, the display won't be closed. ++Str (talk) 09:01, 9 February 2016 (CET)