P.OnMouseWheeled

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameOnMouseWheeled
SyntaxPANEL:OnMouseWheeled( Float delta )
DescriptionThis is called whenever the middle mouse button is wheeled. Don't be dependant on this however. Not all users have mouse wheels on their mouse.
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=P.OnMouseWheeled]P.OnMouseWheeled [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionWhenever you press the wheel on your mouse you will be killed.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 25,25 )
DermaPanel:SetSize( 200, 250 )
DermaPanel:SetTitle( "Wolfo's Fancy Little Panel" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
 
local DermaButton = vgui.Create( "DButton", DermaPanel ) 
DermaButton:SetPos( 25,25 )
DermaButton:SetSize( 150, 200 )
DermaButton:SetText( "Wolfo's Fancy Little Button" )
DermaButton:SetVisible( true )
function DermaButton:OnMouseWheeled(mc)
RunConsoleCommand("kill")
end
 
OutputDetects when the wheel on your mouse is moved.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox