Garry's Mod Wiki

Slider

Description

We advise against using this. It may be changed or removed in a future update. Only exists for backwards compatibility with Panel:SetActionFunction and Panel:PostMessage. Use DNumSlider instead.

A simple slider featuring an numeric display.

Parent

Derives methods, etc not listed on this page from Panel.

Example

Creates a slider atop a DFrame which prints its value as it's being dragged.

local frame = vgui.Create( "DFrame" ) frame:SetSize( 280, 70 ) frame:Center() frame:SetTitle( "Bilderberg Group Dollar Value Slider" ) frame:MakePopup() local DermaSlider = vgui.Create("Slider", frame) DermaSlider:SetPos( 0, 30 ) DermaSlider:SetWide( 100 ) DermaSlider:SetMin( 0 ) DermaSlider:SetMax( 1.0 ) DermaSlider:SetValue( 0.5 ) DermaSlider:SetDecimals( 2 ) DermaSlider.OnValueChanged = function( panel, value ) print( tostring( value ) ) end