Garry's Mod Wiki




Sets the action signal command that's fired when a Button is clicked. The hook PANEL:ActionSignal is called as the click response.

This has no effect on buttons unless it has had its AddActionSignalTarget method called (an internal function not available by default in Garry's Mod LUA).

A better alternative is calling Panel:Command when a DButton is clicked.


Creates an engine-based Frame panel and changes the command that's fired when you click the white close button (by default the command is set to Close).

-- Create a regular Frame panel local TestFrame = vgui.Create( "Frame" ) TestFrame:SetSize( 200, 200 ) TestFrame:Center() TestFrame:MakePopup() TestFrame:SetVisible( true ) local lbl = vgui.Create( "DLabel", TestFrame ) lbl:Dock( FILL ) lbl:DockMargin( 10, 10, 10, 10 ) lbl:SetText( "Click the white button in the upper right corner of this window." ) lbl:SetFont( "ChatFont" ) lbl:SetWrap( true ) -- Create a background panel so we can see the Frame's internal buttons local bg = vgui.Create( "DPanel", TestFrame ) bg:Dock( FILL ) bg:SetBackgroundColor( Color( 64, 64, 64, 192 ) ) bg:MoveToBack() -- Loop through Frame's internal components for _, child in ipairs( TestFrame:GetChildren() ) do -- Disable frame sizing if ( string.find( child:GetName(), "Grip" ) ) then child:SetMouseInputEnabled(false) -- Fire the "Testing" command when we click the white button elseif ( child:GetName() == "frame_close" ) then child:SetCommand( "Testing" ) end end function TestFrame:ActionSignal( signalName, signalValue ) -- Show the signal name lbl:SetText( "Received command: \"" .. signalName .. "\"" ) end

Page Links

Special Pages



Render Time: 35ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 10
Render Body 0
Render Sidebar 12