MindScape00 (talk | contribs) (Created page with "{{widgethandler}}<br> == Description == Called whenever the value of the slider was changed, or the thumb of the slider is being moved. Note that this will call even if the...") Tag: WoW API docs |
MindScape00 (talk | contribs) (Fixed examples formatting) Tags: WoW API docs Visual edit |
||
Line 17: | Line 17: | ||
MySlider:SetOrientation('HORIZONTAL') |
MySlider:SetOrientation('HORIZONTAL') |
||
MySlider:SetScript("OnValueChanged", function(self,value,userInput) |
MySlider:SetScript("OnValueChanged", function(self,value,userInput) |
||
− | + | if userInput then |
|
− | + | print("Hey! Quit Dragging me!") |
|
− | + | else |
|
− | + | print("Oo, I moved without being touched! Spooky!") |
|
− | + | end |
|
end) |
end) |
||
The named arguments are also available in XML handlers: |
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"> |
|
⚫ | |||
− | edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true"> |
||
− | + | <TileSize val="8"/> |
|
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | end |
||
⚫ | |||
⚫ | |||
− | end |
||
+ | </Scripts> |
||
⚫ | |||
− | + | </Slider> |
|
− | </Slider> |
Revision as of 00:20, 14 June 2021
The API is no longer being updated here until further notice. |
Description
Called whenever the value of the slider was changed, or the thumb of the slider is being moved. Note that this will call even if the value has not actually changed the thumb is dragged.
Arguments
- self
- Table - 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:SetWidth(20) MySlider:SetHeight(100) MySlider:SetOrientation('HORIZONTAL') MySlider:SetScript("OnValueChanged", function(self,value,userInput) if userInput then print("Hey! Quit Dragging me!") else print("Oo, I moved without being touched! Spooky!") 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>