Garry's Mod Wiki

Revision Difference

Button#548600

<panel> <parent>DLabel</parent> <description><deprecated>Only exists for backwards compatibility with <page>Panel:SetActionFunction</page>. Use <page>DButton</page> instead.</deprecated>Creates a button that players can click on.</description> </panel> <example> <description>Creates a button with the text "Click Me" that when pressed prints "Hello World!" in the console.</description> <code> local button = vgui.Create( "Button" ) button:SetSize( 150, 30 ) button:Center() button:SetVisible( true ) button:SetText( "Click Me" ) function button:OnMousePressed() print( "Hello World!" ) end </code> ⤶ </example>⤶ ⤶ <output><image src="DLabel.png"/></output>⤶ </example>⤶