Thread Tools Display Modes
03-04-11, 11:38 AM   #1
lilgulps
A Theradrim Guardian
 
lilgulps's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 62
setvaluestep

Code:
local scaleSlider = CreateFrame("Slider", "SPGaugeScaleSlider", spgauge, "OptionsSliderTemplate")
scaleSlider:SetPoint("TOPLEFT", btnManualReport, "BOTTOMLEFT", 10, -100)
scaleSlider:SetWidth(132) 
scaleSlider:SetHeight(17)
scaleSlider:SetMinMaxValues(0.1,2)
scaleSlider:SetValue(scale)
scaleSlider:SetValueStep(.1)

getglobal(scaleSlider:GetName() .. 'Low'):SetText('0.1');
getglobal(scaleSlider:GetName() .. 'High'):SetText('2');
getglobal(scaleSlider:GetName() .. 'Text'):SetText('Scale');

scaleSlider:SetScript("OnMouseUp", function(frame)
	scale = frame:GetValue()
	scaleBox:SetText(scale)
end)

scaleBox = CreateFrame("EditBox", "SPGaugeScaleBox", spgauge, "InputBoxTemplate")
scaleBox:SetPoint("TOPRIGHT", scaleSlider, "BOTTOMRIGHT", 0, -5)
scaleBox:SetAutoFocus(false)
scaleBox:EnableMouse(false)
scaleBox:SetNumeric(false)
scaleBox:SetWidth(20)
scaleBox:SetHeight(20)

scaleBox:SetScript("OnShow", function(frame)
	frame:SetText(scale)
end)
Why is it that this code isn't stepping from 1 to 1.1 to 1.2 but instead its stepping from 1 to like 1.45923803 and very obscure integers?
  Reply With Quote
03-04-11, 11:50 AM   #2
lilgulps
A Theradrim Guardian
 
lilgulps's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 62
solved by some simple trickery!

Code:
scaleSlider:SetMinMaxValues(1,20)
scaleSlider:SetValue(scale*10)
scaleSlider:SetValueStep(1)

getglobal(scaleSlider:GetName() .. 'Low'):SetText('0');
getglobal(scaleSlider:GetName() .. 'High'):SetText('2');
getglobal(scaleSlider:GetName() .. 'Text'):SetText('Scale');

scaleSlider:SetScript("OnMouseUp", function(frame)
	scale = ((frame:GetValue())/10)
	scaleBox:SetText(scale)
end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » setvaluestep

Thread Tools
Display Modes

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