From Garry's Mod
Called when the label is right clicked (on key release) by the player.
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
I was clicked!When the label is right clicked.