Sets the minimum increment between allowed slider values. The portion of the slider frame's area in which the slider thumb moves is its width (or height, for vertical sliders) minus 16 pixels on either end. If the number of possible values determined by the slider's minimum, maximum, and step values is less than the width (or height) of this area, the step value also affects the movement of the slider thumb; see example for details.
Signature:
Code
Slider:SetValueStep(step)
Arguments:
- step - Minimum increment between allowed slider values (number)
Examples:
-- creates a sample horizontal slider
-- (also gives it the default UI's standard slider background,
-- since sliders don't automatically come with one)
CreateFrame("Slider","S",UIParent)
S:SetPoint("CENTER")
S:SetWidth(132)
S:SetHeight(17)
S:SetOrientation("HORIZONTAL")
S:SetThumbTexture("Interface\Buttons\UI-SliderBar-Button-Horizontal")
S:SetMinMaxValues(0,100)
S:SetValue(50)
S:SetBackdrop({
bgFile = "Interface\Buttons\UI-SliderBar-Background",
edgeFile = "Interface\Buttons\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 6, bottom = 6 }})
-- notice the slider thumb moves smoothly across the slider's length when dragged
-- and S:GetValue() often returns non-integer results when dragging
-- now, restrict the slider's value step a bit:
S:SetValueStep(1)
-- notice the slider thumb still moves smoothly when dragged
-- but S:GetValue() now returns only integer results
-- further restricting the slider's value step:
S:SetValueStep(25)
-- now the slider thumb can only be dragged to one of
-- five different positions: 0, 25, 50, 75, or 100