Garry's Mod Wiki

DButton:DoRightClick

  DButton:DoRightClick()

Description

Called when the button is right clicked (on key release) by the player.

See also DButton:DoClick.

Example

Creates a 100 x 100 pixel button in the center of the screen, that prints Hello World! to the Chat and disappears when right clicked.

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:DoRightClick() -- Defines what should happen when the label is clicked chat.AddText("Hello World!") self:Remove() end
Output:
Hello World!

When the button was right clicked.