Garry's Mod Wiki

DLabel:DoRightClick

  DLabel:DoRightClick()

Description

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

This will be called after DLabel:OnDepressed and DLabel:OnReleased.

See also DLabel:DoClick, DLabel:DoMiddleClick and DLabel:DoDoubleClick.

Example

Creates a label in the center of the screen, that prints I was right clicked! to the console and disappears when right clicked.

local lbl = vgui.Create( "DLabel" ) lbl:SetFont( "DermaLarge" ) lbl:SetText( "Click me!" ) lbl:SizeToContents() lbl:Center() lbl:SetMouseInputEnabled( true ) function lbl:DoRightClick() print("I was right clicked!") self:Remove() end
Output:
I was clicked!

When the label is right clicked.