Thread Tools Display Modes
05-28-10, 11:47 PM   #1
Artimidrous121
A Deviate Faerie Dragon
 
Artimidrous121's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 11
CheckBox Help

ok so i have created checkboxes In XML using this code

Code:
<CheckButton name="HealthBarCheckbox" inherits="UICheckButtonTemplate" enableMouse="true" text="Health Bar (Reload Is Required)">
<Size>
	<AbsDimension x="33" y="31" />
</Size>
<Anchors>
	<Anchor point="TOPLEFT" relativeTo="$parent">
<Offset>
	<AbsDimension x="20" y="-40" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
		<OnClick>HealthBarCheckbox_OnClick();</OnClick>
</Scripts>
		<HighlightColor r="0.72" g="0.53" b="0.04" />
</CheckButton>
the function listed here is below if that is necessary

Code:
function HealthBarCheckbox_OnClick()

if( select(4, GetAddOnInfo("MerlinsUI_HPBar")) ) then
DisableAddOn("MerlinsUI_HPBar")
MerlinsUIRelaodAlert:Show();
else
EnableAddOn("MerlinsUI_HPBar")
MerlinsUIRelaodAlert:Show();
end

end
now My question is when the addon is enabled how to i change the graphic for the checkbox to be checked by default?

for example if addon is enabled then the box is checked even after a ui reload but if it is disabled the box is not checked.

Thanks in advance
  Reply With Quote
05-29-10, 02:33 AM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Without seeing more code it's hard to say exactly where to put stuff. But you probably need to use SavedVariables to keep track of the state of the button. Then when you're addon loads you check if the box should be checked and then call :SetChecked(true) on the button.
__________________
Oh, the simulated horror!
  Reply With Quote
05-29-10, 08:21 AM   #3
Artimidrous121
A Deviate Faerie Dragon
 
Artimidrous121's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 11
Thanks
Originally Posted by Ailae View Post
:SetChecked(true) o
that was exactly what i was looking for
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » CheckBox Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off