Garry's Mod Wiki

DNumberScratch

Description

Choose a number from a number line, with zooming for precision. Zoom in by moving your mouse forward and moving back does the opposite. Looks like a blue circle until you click and hold on it

Parent

Derives from DImageButton.

Methods

DNumberScratch:DrawNotches( number level, number x, number y, number w, number h, number range, number value, number min, number max )
This is used internally - although you're able to use it you probably shouldn't. Used by DNumberScratch:DrawScreen.
DNumberScratch:DrawScreen( number x, number y, number w, number h )
This is used internally - although you're able to use it you probably shouldn't. Used by DNumberScratch:PaintScratchWindow.
boolean DNumberScratch:GetActive()
Returns whether this panel is active or not, i.e. if the player is currently changing its value.
number DNumberScratch:GetDecimals()
Returns the desired amount of numbers after the decimal point.
number DNumberScratch:GetFloatValue()
Returns the real value of the DNumberScratch as a number. See also DNumberScratch:GetTextValue and DNumberScratch:GetFraction.
number DNumberScratch:GetFraction()
Returns the value of the DNumberScratch as a fraction, a value between 0 and 1 where 0 is the minimum and 1 is the maximum value of the DNumberScratch. See also: DNumberScratch:GetTextValue DNumberScratch:GetFloatValue DNumberScratch:SetFraction
number DNumberScratch:GetMax()
Returns the maximum value that can be selected on the number scratch
number DNumberScratch:GetMin()
Returns the minimum value that can be selected on the number scratch
number DNumberScratch:GetRange()
Returns the range of the DNumberScratch. Basically max value - min value.
boolean DNumberScratch:GetShouldDrawScreen()
Returns whether the scratch window should be visible or not.
string DNumberScratch:GetTextValue()
Returns the real value of the DNumberScratch as a string. See also DNumberScratch:GetFloatValue and DNumberScratch:GetFraction.
number DNumberScratch:GetZoom()
Returns the zoom level of the scratch window
number DNumberScratch:IdealZoom()
Returns the ideal zoom level for the panel based on the DNumberScratch:GetRange.
boolean DNumberScratch:IsEditing()
Returns whether the player is currently editing the value of the DNumberScratch.
DNumberScratch:LockCursor()
This is used internally - although you're able to use it you probably shouldn't. Used to lock the cursor in place.
DNumberScratch:OnValueChanged( number newValue )
Called when the value of the DNumberScratch is changed.
DNumberScratch:PaintScratchWindow()
This is used internally - although you're able to use it you probably shouldn't. Used to paint the 'scratch' window.
DNumberScratch:SetActive( boolean active )
This is used internally - although you're able to use it you probably shouldn't. Sets whether or not the panel is 'active'. Forcing this panel to be active may not work.
DNumberScratch:SetDecimals( number decimals )
Sets the desired amount of numbers after the decimal point.
DNumberScratch:SetFloatValue( number val )
This is used internally - although you're able to use it you probably shouldn't. Does not trigger DNumberScratch:OnValueChanged Use DNumberScratch:SetValue instead.
DNumberScratch:SetFraction( number frac )
Sets the value of the DNumberScratch as a fraction, a value between 0 and 1 where 0 is the minimum and 1 is the maximum value of the DNumberScratch
DNumberScratch:SetMax( number max )
Sets the max value that can be selected on the number scratch
DNumberScratch:SetMin( number min )
Sets the minimum value that can be selected on the number scratch.
DNumberScratch:SetShouldDrawScreen( boolean shouldDraw )
This is used internally - although you're able to use it you probably shouldn't. Sets if the scratch window should be drawn or not. Cannot be used to force it to draw, only to hide it, which will not stop the panel from working with invisible window.
DNumberScratch:SetValue( number val )
Sets the value of the DNumberScratch and triggers DNumberScratch:OnValueChanged
DNumberScratch:SetZoom( number zoom )
Sets the zoom level of the scratch panel.
DNumberScratch:UpdateConVar()
This is used internally - although you're able to use it you probably shouldn't. Forces the assigned ConVar to be updated to the value of this DNumberScratch

Example

Create the Number Scratch with the minimum number being 0 and the max being 20

local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 250 ) frame:Center() frame:MakePopup() local Scratch = vgui.Create( "DNumberScratch", frame ) Scratch:SetPos( 50, 50 ) Scratch:SetValue( 5 ) Scratch:SetMin( 0 ) Scratch:SetMax( 20 )
Output:

Page Links


Special Pages


Wikis

?

Render Time: 106ms

DB GetPage 16
Generate Html 3
SaveChanges (1) 71
Render Body 0
Render Sidebar 13