Thread Tools Display Modes
12-10-05, 02:06 AM   #1
xmlover
A Fallenroot Satyr
Join Date: Oct 2005
Posts: 25
Q : how to set the CheckBOX's TEXT Gray when it's unchecked

i tried the ButtonName:SetDisabledTextColor( .5, .5, .5 ) method from wowwiki.com

but it doesn't work

only :SetTextColor() works.....

but it's got a long long codes in the UPDATE function


is there a value of CheckButton, which when i set it. the button will automaticly recolor depends it's situation?
  Reply With Quote
12-10-05, 02:45 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
If your checkbutton inherits UICheckButtonTemplate, this is in UIPanelTemplates.xml and it looks like:
<CheckButton name="UICheckButtonTemplate" virtual="true">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentText" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="-2" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check"/>
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled"/>
</CheckButton>
So you could set the color by doing CheckButtonText:SetTextColor(.5,.5,.5) or CheckButtonText:SetTextColor(1,1,1) depending on its state after it's checked.

I assume you're using that since a checkbutton that doesn't inherit anything has no text associated with it.
  Reply With Quote
12-10-05, 09:55 AM   #3
xmlover
A Fallenroot Satyr
Join Date: Oct 2005
Posts: 25
Originally Posted by Gello
If your checkbutton inherits UICheckButtonTemplate, this is in UIPanelTemplates.xml and it looks like:

So you could set the color by doing CheckButtonText:SetTextColor(.5,.5,.5) or CheckButtonText:SetTextColor(1,1,1) depending on its state after it's checked.

I assume you're using that since a checkbutton that doesn't inherit anything has no text associated with it.

hmmm, my CheckButtonTemplates inherits from the UICheckButtonTemplate........

kaka.. i know the :SetTextColor() method. but i got 38 checkbuttons......and that means tons of IF...ELSE statement....

i just wanna know why the :SetDisabledTextColor() method doesn't work

i assume it can set the color automaticly by the name of this method
  Reply With Quote
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
12-11-05, 01:06 AM   #5
xmlover
A Fallenroot Satyr
Join Date: Oct 2005
Posts: 25
thx Gello

once i think of seting it one by one

what u write mentioned me


now i create a table with all the names of CheckButtons in it

and a FOR statement solves all problems
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Q : how to set the CheckBOX's TEXT Gray when it's unchecked


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