Garry's Mod Wiki

DTooltip

Description

This is used internally - although you're able to use it you probably shouldn't.

The panel used internally for tool tips. See Panel:SetTooltip.

View source

Parent

Derives methods, etc not listed on this page from DLabel.

Methods

DTooltip:Close()
Forces the tooltip to close. This will remove the panel.
DTooltip:DrawArrow( number x, number y )
Used to draw a triangle beneath the DTooltip Requires DTooltip:SetContents, without this it will error
DTooltip:OpenForPanel( Panel pnl )
This is used internally - although you're able to use it you probably shouldn't. Sets up the tooltip for display for given panel and starts the timer. Normally you wouldn't call this and you'd use Panel:SetTooltip, Panel:SetTooltipPanel or Panel:SetTooltipPanelOverride.
DTooltip:PositionTooltip()
This is used internally - although you're able to use it you probably shouldn't. Positions the DTooltip so it doesn't stay in the same draw position.
DTooltip:SetContents( Panel panel, boolean delete = false )
What Panel you want put inside of the DTooltip You can only have one Panel at a time; use Parenting to add more

Example

Drawing a Tool Tip manually, then painting over it.

local DFrame = vgui.Create( "DFrame" ) DFrame:SetPos( 100, 100 ) DFrame:SetSize( 100, 100 ) local DTooltip = vgui.Create( "DTooltip" ) DTooltip:SetPos( 0, 0 ) DTooltip:SetSize( 250, 50 ) DTooltip:SetText( "Manual Tooltip" ) DTooltip:OpenForPanel( DFrame ) DTooltip:PositionTooltip() DTooltip.Paint = function() draw.RoundedBox( 5, 0, 0, 250, 50, Color( 255, 255, 255, 255 ) ) end