Garry's Mod Wiki

Revision Difference

Button#517134

<panel> <parent>DLabel</parent> <description><deprecated>Only exists for backwards compatibility with <page>Panel:SetActionFunction</page>. Use <page>DButton</deprecated> instead.</page>Creates a button that players can click on.</description> <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>