Garry's Mod Wiki

Panel:SetTooltipPanelOverride

  Panel:SetTooltipPanelOverride( string override )

Description

Sets the panel class to be created instead of DTooltip when the player hovers over this panel and a tooltip needs creating.

Arguments

1 string override
The panel class to override the default DTooltip. The new panel class must have the following methods:

Example

Create a custom drawn tooltip.

local PANEL = {} function PANEL:Paint( w, h ) -- My fancy white background draw.RoundedBox( 5, 0, 0, w, h, Color( 255, 255, 255, 255 ) ) end vgui.Register( "MyCustomTooltipPanel", PANEL, "DTooltip" ) concommand.Add( "test_custom_tooltip", function( ply ) local DFrame = vgui.Create( "DFrame" ) DFrame:SetSize( 200, 200 ) DFrame:Center() DFrame:MakePopup() local btn = DFrame:Add( "DButton" ) btn:SetPos( 20, 40 ) btn:SetSize( 100, 64 ) btn:SetText( "Hover over me!" ) btn:SetTooltip( "I am the tooltip text with a custom panel!" ) btn:SetTooltipPanelOverride( "MyCustomTooltipPanel" ) end )
Output:
image.png