-
Posted by petcas on Sat, 12 Jan 2013 22:55:22
I am trying to add a configuration slider to my config window. I can get the slider to show, but cannot figure how to show the text version of the slider position. The slider shows up in my config widow and i am able to slide it but I want to show the numeric value of the slider position in a box below the slider.
Any help would be very wonderful
Thanks
-
Posted by stolenlegacy on Fri, 18 Jan 2013 18:30:46
Are you using any library to provide your config interface or are you writing it yourself?
-
Posted by petcas on Tue, 22 Jan 2013 16:59:54
I have a config.lua and config.xml that I wrote. I haven't used any libraries for the config panel. The config panel has been working with just radio buttons, but i need to add a way for the user to input a numeric limit.
This puts the slider in the config panel. do i need to add a separate text box for the number display? or is there one that is tied to the slider?
XML Code: `
<Slider name="$parentMaxiLvLSlider" inherits="OptionsSliderTemplate"> <Size> <AbsDimension x="440" y="20"/> </Size> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parentCheckButtonSoulbound"> <Offset><AbsDimension x="0" y="-40"/></Offset> </Anchor> </Anchors> <Scripts> <OnLoad> getglobal(self:GetName().."Text"):SetText("iLvL sell below"); getglobal(self:GetName().."High"):SetText("509"); getglobal(self:GetName().."Low"):SetText("0"); self:SetMinMaxValues(0,509); self:SetValueStep(1); </OnLoad> </Scripts> </Slider>
`
Thank in Advance
-
Posted by Philburt on Tue, 29 Jan 2013 17:10:02
Hope this helps:
My XML code is
<Frames> <Slider name="CashProfitSlider" inherits="OptionsSliderTemplate" minValue="0" maxValue="500" defaultValue="50" valueStep="5" orientation="HORIZONTAL"> <Size x="284" y="21" /> <Anchors> <Anchor point="TOPLEFT"> <Offset x="480" y="-167" /> </Anchor> </Anchors> <Scripts> <OnLoad>CashProfitSlider_OnLoad(self:GetName())</OnLoad> <OnValueChanged>_G[self:GetName().."Text"]:SetText(_G[self:GetName()]:GetValue())</OnValueChanged> </Scripts> </Slider> </Frames>
with the lua code being :
function CashProfitSlider_OnLoad(slider) local sl=_G[slider] sl.tooltipText = "|cffffff00This is the Minimum Gold Profit you are looking for."; _G[slider.."Low"]:SetText("0"); _G[slider.."High"]:SetText("500"); _G[slider.."Text"]:SetText("50"); end
Not the most elegant of code, but i think the bit you need is the OnValueChanged line.