WoW:API CheckButton SetChecked: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 9: | Line 9: | ||
:(State) | :(State) | ||
:;State : Mixed - Basically expressions LUA evaluates to | :;State : Mixed - Basically expressions LUA evaluates to '''true''' will check the button. Everything else will uncheck. | ||
=== Returns === | === Returns === | ||
:nil | :nil | ||
Line 21: | Line 22: | ||
CheckButton:SetChecked(-2397); | CheckButton:SetChecked(-2397); | ||
CheckButton:SetChecked("-2397"); | CheckButton:SetChecked("-2397"); | ||
CheckButton:SetChecked({1,2,3}); | |||
CheckButton:SetChecked("foo"); | |||
CheckButton:SetChecked(); | |||
====Result==== | ====Result==== | ||
Line 28: | Line 32: | ||
CheckButton:SetChecked(false); | CheckButton:SetChecked(false); | ||
CheckButton:SetChecked(0); | CheckButton:SetChecked(0); | ||
CheckButton:SetChecked( | CheckButton:SetChecked(nil); | ||
====Result==== | ====Result==== | ||
Line 39: | Line 41: | ||
====Patch 1.11 WARNING==== | ====Patch 1.11 WARNING==== | ||
In patch 1.11 it seems like this method was changed so that it no longer works when passing '''nil''' as argument. I have tested that it works as intended when passing '''true''' and '''false'''. | In patch 1.11 it seems like this method was changed so that it no longer works when passing '''nil''' as argument. I have tested that it works as intended when passing '''true''' and '''false'''. | ||
That's not really correct. Passing "nil" will still uncheck the button, but passing *no* argument (although it should end up being nil for LUA) will enable it, also passing a table ({...}) will now check the button. [[User:Watchout|watchout]] 12:43, 29 June 2006 (EDT) |
Revision as of 16:51, 29 June 2006
← Widget API ← CheckButton < SetChecked
Sets the status of a CheckButton.
CheckButton:SetChecked(State);
Parameters
Arguments
- (State)
- State
- Mixed - Basically expressions LUA evaluates to true will check the button. Everything else will uncheck.
Returns
- nil
- nil
- This function will always return nil.
Example
CheckButton:SetChecked(true); CheckButton:SetChecked(1); CheckButton:SetChecked(-2397); CheckButton:SetChecked("-2397"); CheckButton:SetChecked({1,2,3}); CheckButton:SetChecked("foo"); CheckButton:SetChecked();
Result
Button is checked
Example
CheckButton:SetChecked(false); CheckButton:SetChecked(0); CheckButton:SetChecked(nil);
Result
Button is unchecked
Patch 1.11 WARNING
In patch 1.11 it seems like this method was changed so that it no longer works when passing nil as argument. I have tested that it works as intended when passing true and false.
That's not really correct. Passing "nil" will still uncheck the button, but passing *no* argument (although it should end up being nil for LUA) will enable it, also passing a table ({...}) will now check the button. watchout 12:43, 29 June 2006 (EDT)