DButton.IsDown

From GMod Wiki

Jump to: navigation, search
Function
Syntax DButton:IsDown( )
Description:
Returns true if pressed and nil when unpressed.
Returns: Boolean
In Object: DButton
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DButton.IsDown]DButton.IsDown [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionMake a button and text to demonstrate DButton:IsDown().
Used onNewerClient.png
Code
local Frame = vgui.Create( "DFrame" ) --Create a frame to test this on
Frame:SetPos( 10,10 )
Frame:SetSize( 300,300 )
Frame:SetTitle( "Testing a Button" )
 
	local Clicker = vgui.Create( "DButton", Frame ) --Create a button
	Clicker:SetPos( 25, 50 )
	Clicker:SetSize( 100, 20 )
	Clicker:SetText( "Clicker" )
 
	local Panel = vgui.Create( "DPanel", Frame ) --Create a panel to draw text on, so we can see what Clicker:IsDown() does.
	Panel:SetPos( 25, 100 )
	Panel.Paint = function()
 
		draw.DrawText(tostring(Clicker:IsDown()), "Default", 0, 0, Color(250,250,250,255), 0) --Paint what Clicker:IsDown() is outputting.
 
	end
OutputA frame with a button and text, the text will change to "true" when the button is pressed and "nil" when unpressed.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox