ctrlCreate – Talk
Lou Montana (talk | contribs) m (Text replacement - "<dl class="command_description"> <dd class="notedate">" to "<dl class="command_description"> <dt></dt> <dd class="notedate">") |
Lou Montana (talk | contribs) m (Text replacement - "Killzone Kid" to "Killzone_Kid") |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
'''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 <br> | '''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 <br> | ||
of being clicked.<br> | of being clicked.<br> | ||
<code>_ctrl = ([[findDisplay]] 12345) [[ctrlCreate]] ["RscButtonMenu", 2]; | <code style="display: block">_ctrl = ([[findDisplay]] 12345) [[ctrlCreate]] ["RscButtonMenu", 2]; | ||
_ctrl [[ctrlSetText]] "Button"; | _ctrl [[ctrlSetText]] "Button"; | ||
_ctrl [[ctrlSetEventHandler]] ["MouseButtonDown", "(_this select 0) [[ctrlEnable]] false"];</code><br> | _ctrl [[ctrlSetEventHandler]] ["MouseButtonDown", "(_this select 0) [[ctrlEnable]] false"];</code><br> | ||
Line 12: | Line 12: | ||
== Historic notes == | == Historic notes == | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<dt></dt> | <dt></dt> | ||
Line 21: | Line 20: | ||
</dd> | </dd> | ||
</dl> | </dl> | ||
Fixed sometime in 1.67 [[User: | Fixed sometime in 1.67 [[User:Killzone_Kid|Killzone_Kid]] ([[User talk:Killzone_Kid|talk]]) 19:25, 1 March 2017 (CET) |
Latest revision as of 13:48, 12 March 2024
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)
Historic notes
- Posted on December 30, 2015 - 01:48 (UTC)
- Molaron
- "RscListBox" created via ctrlCreate is buggy, you can only select the first seven items.
Fixed sometime in 1.67 Killzone_Kid (talk) 19:25, 1 March 2017 (CET)