Code:
city = 320
normal = 120
combat = 50
-- Functions that change the height
function ChatHeight_City()
DEFAULT_CHAT_FRAME:SetHeight(city);
end
function ChatHeight_Normal()
DEFAULT_CHAT_FRAME:SetHeight(normal);
end
function ChatHeight_Combat()
DEFAULT_CHAT_FRAME:SetHeight(combat);
end
I created the sliders in xml. Here is an example:
Code:
<Slider name="slider1" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="220" y="16"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset><AbsDimension x="0" y="120"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText("Normal Height");
getglobal(this:GetName().."High"):SetText("600");
getglobal(this:GetName().."Low"):SetText("50");
this:SetMinMaxValues(50,600);
this:SetValueStep(10);
</OnLoad>
<OnValueChanged> sliderUpdate(); </OnValueChanged>
but I have no idea what to do with the sliderUpdate function.
I want to thank everyone for all the help I have been getting. My 1st addon is almost complete!
- Cogs|||Quote:
but I have no idea what to do with the sliderUpdate function.
"Slider:GetValue()" would do the trick to read the position of the slider.
Also, you should set the orientation of the slider somewhere. In LUA-code it's like this:
Slider:SetOrientation("orientation") - "HORIZONTAL" or "VERTICAL".|||Thank you. Took some fiddling, but I got it.|||
There's only 1 variable to Sliders, enjoyment.|||My 1st addon is nearly complete, but the last step is driving my crazy. I have the those 3 variables (plus 1 more for a checkbox) saved per character and I want them to be pre-set into the options panel. I am using this:SetValue(normal), this:SetValue(city), this:SetValue(combat), and this:SetChecked(combatHide) to load the variables into the options, but it is using my original, default variables when I do this and not my saved variables. How do I make it set to the saved variables?
Thanks again. And thanks for that delicious slider pic. Now I am hungry! White Castle here I come.
- Cogs|||Got it. Not sure if it is the "right" way to do it, but I set the values with <OnShow>.
No comments:
Post a Comment