DFrame.OnMousePressed
From GMod Wiki
| 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: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=DFrame.OnMousePressed]DFrame.OnMousePressed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | Demonstration of how DFrame:OnMousePressed works |
|---|---|
| Used on | |
| 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 |
| Output | Prints "You clicked left on the DFrame" in console when you left click the DFrame |
Additional Notes
- Might be used better in combination with DButton, since that looks more like you can actually click it.
- An overview of Mousecodes can be found here.