Garry's Mod Wiki

DNumberWang

Description

DNumberWang is a VGUI element that allows you to input a numeric value using up and down arrows or direct entry.

Parent

Derives from DTextEntry.

Methods

number DNumberWang:GetDecimals()
Returns the amount of decimal places allowed in the number selector, set by DNumberWang:SetDecimals
number DNumberWang:GetFloatValue()
We advise against using this. It may be changed or removed in a future update. Returns whatever is set by DNumberWang:SetFloatValue or 0.
DNumberWang:GetFraction( number val )
Returns a fraction representing the current number selector value to number selector min/max range ratio. If argument val is supplied, that number will be computed instead.
number DNumberWang:GetMax()
Returns the maximum numeric value allowed by the number selector.
number DNumberWang:GetMin()
Returns the minimum numeric value allowed by the number selector.
Panel DNumberWang:GetTextArea()
We advise against using this. It may be changed or removed in a future update. This function returns the panel it is used on.
number DNumberWang:GetValue()
Returns the numeric value inside the number selector.
DNumberWang:HideWang()
Hides the number selector arrows.
DNumberWang:OnValueChanged( number val )
Internal function which is called when the number selector value is changed. This function is empty by default so it needs to be overridden in order to provide functionality.
DNumberWang:SetDecimals( number num )
Sets the amount of decimal places allowed in the number selector.
DNumberWang:SetFloatValue( number val )
We advise against using this. It may be changed or removed in a future update. Appears to do nothing.
DNumberWang:SetFraction( number val )
Sets the value of the number selector based on the given fraction number.
DNumberWang:SetMax( number max )
Sets the maximum numeric value allowed by the number selector.
DNumberWang:SetMin( number min )
Sets the minimum numeric value allowed by the number selector.
DNumberWang:SetMinMax( number min, number max )
Sets the minimum and maximum value allowed by the number selector.
DNumberWang:SetValue( number val )
Sets the value of the DNumberWang and triggers DNumberWang:OnValueChanged

Example

Create the Number Wang with the minimum number being 0 and the max being 100

local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 250 ) frame:Center() frame:MakePopup() local Wang = vgui.Create("DNumberWang", frame) Wang:SetPos(85, 25) Wang:SetSize(45, 26) Wang:SetMin(0) Wang:SetMax(100) Wang.OnValueChanged = function(self) print(self:GetValue()) end
Output:

Page Links


Special Pages


Wikis

?

Render Time: 76ms

DB GetPage 48
Generate Html 4
SaveChanges (1) 9
Render Body 0
Render Sidebar 12