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? |
If your checkbutton inherits UICheckButtonTemplate, this is in UIPanelTemplates.xml and it looks like:
Quote:
I assume you're using that since a checkbutton that doesn't inherit anything has no text associated with it. |
Quote:
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 |
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. |
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