DButton

From GMod Wiki

Jump to: navigation, search
Derma Control: DButton
Parent Class:DLabel
Subclasses:DComboBoxItem DTab
Description:
A standard button.

Contents

Examples

DescriptionCreates a button on a panel.
Used onNewerClient.png
Code
local window = vgui.Create( "DFrame" )
	window:SetSize( 200,70 )
	window:Center()
	window:SetTitle( "DButton Test" )
	window:MakePopup()
 
local button = vgui.Create( "DButton", window )
	button:SetSize( 100, 30 )
	button:SetPos( 50, 30 )
	button:SetText( "Test Button" )
	button.DoClick = function( button )
		window:SetTitle( "Hello world!" )
	end
Outputbutton01wr5.jpg


DescriptionCreates a button on a panel.
Used onNewerClient.png
Code
// myParent = a Panel based object.
myButton = vgui.Create("DButton", myParent)
myButton:SetText("Hello World!")
myButton.DoClick = function()
        Msg("You clicked the button!\n")
    end
myButton.DoRightClick = function()
        Msg("You right-clicked the button!\n")
    end
 
OutputN/A

Additional Notes

Methods

NewerClient.png DButton.ApplySchemeSettings
NewerClient.png DButton.Center
NewerClient.png DButton.DoClick
NewerClient.png DButton.DoRightClick
NewerClient.png DButton.Init
NewerClient.png DButton.IsDown
NewerClient.png DButton.GenerateExample
NewerClient.png DButton.GetDisabled
NewerClient.png DButton.GetDrawBackground
NewerClient.png DButton.GetDrawBorder
NewerClient.png DButton.GetSelected
NewerClient.png DButton.OnMousePressed
NewerClient.png DButton.OnMouseReleased
NewerClient.png DButton.Paint
NewerClient.png DButton.SetConsoleCommand
NewerClient.png DButton.SetDisabled
NewerClient.png DButton.SetDrawBackground
NewerClient.png DButton.SetDrawBorder
NewerClient.png DButton.SetEnabled
NewerClient.png DButton.SetImage
NewerClient.png DButton.SetSelected

Inherited from DLabel

NewerClient.png DLabel.GetAutoStretchVertical
NewerClient.png DLabel.GetColor
NewerClient.png DLabel.GetTextColor
NewerClient.png DLabel.GetTextColorHovered
NewerClient.png DLabel.OnCursorEntered
NewerClient.png DLabel.OnCursorExited
NewerClient.png DLabel.PerformLayout
NewerClient.png DLabel.SetAutoStretchVertical
NewerClient.png DLabel.SetColor
NewerClient.png DLabel.SetTextColor
NewerClient.png DLabel.SetTextColorHovered

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox