DFrame.OnMousePressed

From GMod Wiki

Jump to: navigation, search
Function
Syntax DFrame:OnMousePressed( MouseCode button )
Description:
Gets called when someone clicks the DFrame. Button is an integer indicating what mouse button was pressed
Returns: Function
In Object: DPropertySheet
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DFrame.OnMousePressed]DFrame.OnMousePressed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDemonstration of how DFrame:OnMousePressed works
Used onNewerClient.png
Code
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 1000, 900 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
DermaPanel.OnMousePressed = function( mcode )
	if mcode == MOUSE_LEFT then
		print("You clicked left on the DFrame")
	end
end
OutputPrints "You clicked left on the DFrame" in console when you left click the DFrame


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox