Garry's Mod Wiki

Revision Difference

DNumSlider#513535

<panel>⤶ <parent>Panel</parent>⤶ <description>The DNumSlider allows you to create a slider, allowing the user to slide it to set a value, or changing the value in the box.</description>⤶ ⤶ </panel>⤶ ⤶ ⤶ <example>⤶ <description>Attempts to create a DNumSlider.</description>⤶ <code>⤶ local DermaPanel = vgui.Create( 'DFrame' ) // Create a panel to parent it to⤶ DermaPanel:SetSize( 500, 200 ) // Set the size⤶ DermaPanel:Center() // Center it⤶ DermaPanel:MakePopup() // Make it a popup⤶ ⤶ local DermaNumSlider = vgui.Create( "DNumSlider", DermaPanel )⤶ DermaNumSlider:SetPos( 50, 50 ) // Set the position⤶ DermaNumSlider:SetSize( 300, 100 ) // Set the size⤶ DermaNumSlider:SetText( "Maximum props" ) // Set the text above the slider⤶ DermaNumSlider:SetMin( 0 ) // Set the minimum number you can slide to⤶ DermaNumSlider:SetMax( 256 ) // Set the maximum number you can slide to⤶ DermaNumSlider:SetDecimals( 0 ) // Decimal places - zero for whole number⤶ DermaNumSlider:SetConVar( "sbox_maxprops" ) // Changes the ConVar when you slide⤶ </code>⤶ ⤶ </example>⤶ ⤶