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 methods, etc not listed on this page from DTextEntry.
Events
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:GetInterval()
Returns interval at which the up and down buttons change the current value.
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.
DNumberWang:HideWang()
Hides the number selector arrows.
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:SetInterval( number min )
Sets interval at which the up and down buttons change the current value.
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: 
