ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Button Handler ButtonStates (https://www.esoui.com/forums/showthread.php?t=8385)

Baumkuchen3 03/07/19 09:15 AM

Button Handler ButtonStates
 
1.
I want to remove the setted Handler within the "OnClicked" event. How can I do this. I dont know witch parameters the "function(.....) " (the 2. parameter of "button:SetHandler()" can use and how to access the button itself. "self" does not work here.

My Example function --- which will set the button handler:


Code:

function addon.InitControls(rowNumber)

 deleteButton:SetHandler("OnClicked", function(self) <-- are there other parameter available?
       
    DoSomethingt(rowNumber)

    self:RemoveHandler ("OnClicked") <-- how to remove the handler?

end)

----------------
2. How to Change the Button State in Code. I know hot to hide a control
Code:

deleteButton:SetHidden(true)
But I also want to disable a control/button.

votan 03/07/19 09:31 AM

Quote:

Originally Posted by Baumkuchen3 (Post 37304)
1.
I want to remove the setted Handler within the "OnClicked" event. How can I do this. I dont know witch parameters the "function(.....) " (the 2. parameter of "button:SetHandler()" can use and how to access the button itself. "self" does not work here.

My Example function --- which will set the button handler:


Code:

function addon.InitControls(rowNumber)

 deleteButton:SetHandler("OnClicked", function(self) <-- are there other parameter available?
       
    DoSomethingt(rowNumber)

    self:RemoveHandler ("OnClicked") <-- how to remove the handler?

end)

----------------
2. How to Change the Button State in Code. I know hot to hide a control
Code:

deleteButton:SetHidden(true)
But I also want to disable a control/button.

control:SetHandler("OnClicked", nil)
buttonControl:SetEnabled(false)

https://wiki.esoui.com/Controls#ButtonControl

Baumkuchen3 03/07/19 10:19 AM

Thanks's a lot for your help.
(the big votan answered my question :banana:)

Baertram 03/07/19 10:30 AM

If you need more parameters try to use control:SetHandler("OnMouseUp", function(control, button, upInside)).

control: Your control clicked
button: MouseButtonIndex (the mouse button used):
Code:

MOUSE_BUTTON_INDEX_4
MOUSE_BUTTON_INDEX_5
MOUSE_BUTTON_INDEX_INVALID
MOUSE_BUTTON_INDEX_LEFT
MOUSE_BUTTON_INDEX_LEFT_AND_RIGHT
MOUSE_BUTTON_INDEX_MIDDLE
MOUSE_BUTTON_INDEX_RIGHT

upInsided: boolean. true = mouse button was released while above the control. false = mouse button released outside the control.


All times are GMT -6. The time now is 11:15 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI