Sliders are elements intended to display or allow the user to choose a value in a range. They are often used for configuration, to choose scale, camera distance, and similar settings. Like Buttons, Sliders can be enabled or disabled, but unlike Buttons, they include no support for automatically changing appearance when this is done. You can set both their minimum and maximum values (one function returns or accepts both), and the step by which dragging changes their value. Sliders can be oriented either horizontally or vertically.
While you do not have to provide any code to manage the dragging of a slider's "thumb", you do have to provide a texture that will represent it, which the engine will position and draw automatically. In XML, you do this by providing a <ThumbTexture>
element as a direct child of the <Slider>
element, which can have any of the attributes or children allowed to any <Texture>
element.
Sliders come in two common forms: thin tracks with a wide thumb, used for setting scalar options, or scroll bars used for positioning the contents of a frame.
Defined Methods
- Slider:GetObeyStepOnDrag() - This function is not yet documented
- Slider:GetStepsPerPage() - This function is not yet documented
- Slider:SetEnabled() - This function is not yet documented
- Slider:SetObeyStepOnDrag() - This function is not yet documented
- Slider:SetStepsPerPage() - This function is not yet documented
- Slider:SetThumbTexture(texture [, "layer"]) or Slider:SetThumbTexture("filename" [, "layer"]) - Sets the texture for the slider thumb
- Slider:SetValue(value) - Sets the value representing the position of the slider thumb
- Slider:SetValueStep(step) - Sets the minimum increment between allowed slider values
Inherited Methods
- Slider:GetPropagateKeyboardInput() - This function is not yet documented
- Slider:IsForbidden() - This function is not yet documented
- Slider:RegisterUnitEvent() - This function is not yet documented
- Slider:SetDontSavePosition() - This function is not yet documented
- Slider:SetPropagateKeyboardInput() - This function is not yet documented
- Slider:SetShown() - This function is not yet documented
- Slider:SetSize(width, height) - Sets the size of the region to the specified values
- Slider:SetToplevel(enable) - Sets whether the frame should automatically come to the front when clicked
- Slider:SetUserPlaced(enable) - Flags the frame for automatic saving and restoration of position and dimensions
- Slider:SetWidth(width) - Sets the region's width
- Slider:Show() - Shows the region
- Slider:StartMoving() - Begins repositioning the frame via mouse movement
- Slider:StartSizing() - Begins resizing the frame via mouse movement
- Slider:StopAnimating() - Stops any active animations involving the region or its children
- Slider:StopMovingOrSizing() - Ends movement or resizing of the frame initiated with [[docs/widgets/Frame/StartMoving|`:StartMoving()`]] or [[docs/widgets/Frame/StartSizing|`:StartSizing()`]]
- Slider:UnregisterAllEvents() - Unregisters the frame from any [[docs/events|events]] for which it is registered
- Slider:UnregisterEvent("event") - Unregisters the frame for an event
Script Handlers
- OnAttributeChanged(self, "name", value) - Run when a frame attribute is changed
- OnChar(self, "text") - Run for each text character typed in the frame
- OnDisable(self) - Run when the frame is disabled
- OnDragStart(self, "button") - Run when the mouse is dragged starting in the frame
- OnDragStop(self) - Run when the mouse button is released after a drag started in the frame
- OnEnable(self) - Run when the frame is enabled
- OnEnter(self, motion) - Run when the mouse cursor enters the frame's interactive area
- OnEvent(self, "event", ...) - Run whenever an [[docs/events|event]] fires for which the frame is registered
- OnHide(self) - Run when the frame's visbility changes to hidden
- OnKeyDown(self, "key") - Run when a keyboard key is pressed if the frame is keyboard enabled
- OnKeyUp(self, "key") - Run when a keyboard key is released if the frame is keyboard enabled
- OnLeave(self, motion) - Run when the mouse cursor leaves the frame's interactive area
- OnLoad(self) - Run when the frame is created
- OnMinMaxChanged(self, min, max) - Run when the slider's or status bar's minimum and maximum values change
- OnMouseDown(self, "button") - Run when a mouse button is pressed while the cursor is over the frame
- OnMouseUp(self, "button") - Run when the mouse button is released following a mouse down action in the frame
- OnMouseWheel(self, delta) - Run when the frame receives a mouse wheel scrolling action
- OnReceiveDrag(self) - Run when the mouse button is released after dragging into the frame
- OnShow(self) - Run when the frame becomes visible
- OnSizeChanged(self, width, height) - Run when a frame's size changes
- OnUpdate(self, elapsed) - Run each time the screen is drawn by the game engine
- OnValueChanged(self, value) - Run when the slider's or status bar's value changes