Revision Difference
DButton:DoClick#546542
<cat>panelfunc</cat>⤶
<function name="DoClick" parent="DButton" type="panelhook">⤶
<description>⤶
Called when the button is left clicked (on key release) by the player.⤶
⤶
This will be called after <page>DButton:IsDown</page>.⤶
⤶
</description>⤶
<realm>Client</realm>⤶
</function>⤶
⤶
<example>⤶
<description>Creates a 100 x 100 pixel button in the center of the screen, that prints `Hello World!` to the Chat and disappears when clicked.⤶
</description>⤶
<code>⤶
local DermaButton = vgui.Create( "DButton" ) -- Creates our button⤶
DermaButton:SetText( "Click me!" )⤶
DermaButton:SetSize( 100, 100 )⤶
DermaButton:Center()⤶
DermaButton:SetMouseInputEnabled( true ) -- We must accept mouse input⤶
function DermaButton:DoClick() -- Defines what should happen when the label is clicked⤶
chat.AddText("Hello World!")⤶
self:Remove()⤶
end⤶
</code>⤶
<output>⤶
```⤶
Hello World!⤶
```⤶
When the button was clicked.</output>⤶
</example>⤶
⤶