Garry's Mod Wiki

Revision Difference

DButton#516856

<panel⤶ |parent=dlabel⤶ |preview=dbutton_small.png⤶ |description=a standard derma button.⤶ ⤶ by default, a <page>dbutton</page> is 22px tall. |hooks={{listitem|panel/init}}{{listitem|panel/paint}}{{listitem|panel/performlayout}}{{listitem|panel/generateexample}} <panel>⤶ <parent>DLabel</parent>⤶ <preview>DButton_small.png</preview>⤶ <description>⤶ A standard Derma button. ⤶ By default, a <page>DButton</page> is 22px tall. </description>⤶ <hooks>{{ListItem|PANEL/Init</hooks>⤶ ⤶ </panel>⤶ ⤶ {{ListItem|PANEL/Paint}}{{ListItem|PANEL/PerformLayout}}{{ListItem|PANEL/GenerateExample}}⤶ }} {{example>⤶ <example>⤶ <description>The DButton is exactly what you think it is - a button!</description> <code> local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 250 ) frame:Center() frame:MakePopup() local DermaButton = vgui.Create( "DButton", frame ) // Create the button and parent it to the frame DermaButton:SetText( "Say hi" ) // Set the text on the button DermaButton:SetPos( 25, 50 ) // Set the position on the frame DermaButton:SetSize( 250, 30 ) // Set the size DermaButton.DoClick = function() // A custom function run when clicked ( note the . instead of : ) RunConsoleCommand( "say", "Hi" ) // Run the console command "say hi" when you click it ( command, args ) end </code> <output></output> ⤶ </panel⤶ |parent=dlabel⤶ |preview=dbutton_small.png⤶ |description=a standard derma button.⤶ ⤶ by default, a <page>dbutton</page> is 22px tall.⤶ |hooks={{listitem|panel/init}}{{listitem|panel/paint}}{{listitem|panel/performlayout}}{{listitem|panel/generateexample}}⤶ }}⤶ {{example>⤶ ⤶ </example>⤶