Panel/SetTooltipPanel

From Garry's Mod
Jump to: navigation, search
 Panel:SetTooltipPanel( )

Contents

Description

Sets the panel to be displayed as a tooltip when a player hovers over the panel object with their cursor. Note that it will not override the default DTooltip panel.

NOTE

Panel:SetTooltip will override this functionality.

WARNING

Calling this from PANEL:OnCursorEntered is too late! The tooltip will not be displayed or be updated.

WARNING

Given panel or the previously set one will NOT be automatically removed.

Arguments

Panel tooltipPanel=nil

The panel to use as the tooltip.

Examples

Example

Example usage of this function

local pnl = vgui.Create( "DFrame" )
pnl:SetSize( 500, 500 )
pnl:Center()
pnl:MakePopup()

local p = vgui.Create( "Panel" )
p:SetSize( 100, 100 )
p:SetVisible( false )
p.Paint = function( s, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 0, 0 ) ) end

local c = vgui.Create( "DButton", p )
c:SetText( "test" )
c:SetSize( 50, 50 )
c:SetPos( 5, 5 )

local b = pnl:Add( "DButton" )
b:Dock( TOP )
--b:SetTooltip( "test" ) -- This will stop SetTooltipPanel from working.
b:SetTooltipPanel( p )


Personal tools
Navigation