View Single Post
12-10-05, 12:35 PM   #4
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Oh a checkbutton doesn't have any text associated with it at all. It just so happens the UICheckButtonTemplate has attached a FontString.

SetDisabledTextColor is for buttons. You may notice you can do buttons like this:

<Button text="Click me!">
<Size><AbsDimension x="128" y="24"/></Size>
<Anchors><Anchor point="CENTER"/></Anchors>
</Button>

But there's no equivalent for checkbuttons. If you replace <Button> with <CheckButton> it's going to ignore the text. So that template adds a FontString in a layer attached to the CheckButton:

<CheckButton>
<Size><AbsDimension x="24" y="24"/></Size>
<Anchors><Anchor point="CENTER"/></Anchors>
<Layers><Layer level="BACKGROUND">
<FontString text="Don't click me, click that thing to the right!">
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"/></Anchors>
</Layer></Layers>
</CheckButton>

Note that the size of the checkbutton control is the checkbox itself and doesn't include text.

It sounds like you may not have a template for your checkbuttons. It may be worthwhile to make one if you want to grey out the text:

<CheckButton name="MyCheckButton" inherits="UICheckButtonTemplate" virtual="true">
<Scripts>
<OnClick>
if this:GetChecked() then
getglobal(this:GetName().."Text"):SetTextColor(1,1,1)
else
getglobal(this:GetName().."Text"):SetTextColor(.5,.5,.5)
end
</OnClick>
</Scripts>
</CheckButton>

will both inherit the UICheckButtonTemplate and also darken/lighten the text depending on its state. You will tho have to initialize the colors of course. When you initialize the checkbutton state on login you can set the text color as you set whether it's checked or not.
  Reply With Quote