WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Q : how to set the CheckBOX's TEXT Gray when it's unchecked (https://www.wowinterface.com/forums/showthread.php?t=2610)

xmlover 12-10-05 02:06 AM

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?

Gello 12-10-05 02:45 AM

If your checkbutton inherits UICheckButtonTemplate, this is in UIPanelTemplates.xml and it looks like:
Quote:

<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.

xmlover 12-10-05 09:55 AM

Quote:

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 :D

Gello 12-10-05 12:35 PM

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.

xmlover 12-11-05 01:06 AM

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 :D


All times are GMT -6. The time now is 02:50 PM.

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