DLabel.OnCursorExited

From GMod Wiki

Jump to: navigation, search
Function
Syntax DLabel.OnCursorExited( DLabel label )
Description:
If this is set to a function, it will be called when the cursor exits the control.
Returns: nil
In Object: DLabel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DLabel.OnCursorExited]DLabel.OnCursorExited [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionKills the player when the cursor exits the label.
Used onNewerClient.png
Code
 
makeframe = vgui.Create("DFrame")  -- make the frame
makelabel = vgui.Create("DLabel") -- make the label
 
	makeframe:SetPos(50,50) -- set the frame's position
	makeframe:SetSize(320, 110) -- set the frame's size
	makeframe:SetTitle( "Hello" ) -- set the frame's title
	makeframe:SetVisible( true ) -- make it visible
	makeframe:MakePopup() -- make it popup
 
	makelabel:SetParent( makeframe ) -- set the label's parent
	makelabel:SetText( "DO NOT MOVE YOUR MOUSE OFF THIS LABEL!" ) -- set the label's text
	makelabel:SetPos(5, 25) -- set the label's position within the frame ( because it is parented)
	makelabel:SizeToContents() -- automatically changes the size to the size of the text
	makelabel.OnCursorExited = function() RunConsoleCommand( "kill" ) end -- DEATH
 
 
OutputPlayer death.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox