Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Register
Advertisement

Called whenever a slider's value changes, or its thumb is dragged (even if not dragged far enough to cause a change in value).

Arguments[]

self
Slider - the widget being clicked
value
number - the new value of the slider
userInput
boolean - True if set directly by the thumb being moved, false if set by Slider:SetValue.

Example[]

local MySlider = CreateFrame("Slider", "MySliderGlobalName", ParentFrame, "OptionsSliderTemplate")
MySlider:SetSize(20, 100)
MySlider:SetPoint("CENTER")
MySlider:SetOrientation("HORIZONTAL")
MySlider:SetScript("OnValueChanged", function(self,value,userInput)
	if userInput then 
		print("Manually set by the user")
	else
		print("Set from a script")
	end
end)

The named arguments are also available in XML handlers:

<Slider name="MySlider_Template" orientation="HORIZONTAL" enableMouse="true" virtual="true"> 
	<Size x="144" y="17"/> 
	<Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true">
		<EdgeSize val="8"/> 
		<TileSize val="8"/>
		<BackgroundInsets left="3" right="3" top="6" bottom="6"/>
	</Backdrop>
	<ThumbTexture name="$parentThumb" file="Interface\Buttons\UI-SliderBar-Button-Horizontal">
		<Size x="32" y="32"/>
	</ThumbTexture>
	<Scripts>
	<OnValueChanged> 
		if userInput then 
			print("Hey! Quit Dragging me!") 
		else
			print("Oo, I moved without being touched! Spooky!")
		end
	</OnValueChanged>
	</Scripts>
</Slider>
Advertisement