DSlider.SetSlideX

From GMod Wiki

Jump to: navigation, search
Derma Control: Slider
Parent Class:DSlider
Subclasses:
Description:
Set the position of a slider's grabber.


Examples

DescriptionChanges the grabber's position on a slider. Used to update the clients grabber.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 200, 250 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local Volume=50
local NumSlider = vgui.Create( "DNumSlider", DermaPanel )
NumSlider:SetPos( 25,50 )
NumSlider:SetWide( 100 )
NumSlider:SetText( "Volume" )
NumSlider:SetMin( 0 ) -- Minimum number of the slider
NumSlider:SetMax( 100 ) -- Maximum number of the slider
NumSlider:SetDecimals( 0 ) -- Sets a decimal. Zero means it's a whole number
NumSlider.Slider:SetSlideX(Volume/100) -- This value is between 0 and 1. Since volume is 50 and the max slider is 100 it will be halfway.
 
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox