Panel:SetTooltipPanel
Description
Sets the panel to be displayed as contents of a DTooltip when a player hovers over the panel object with their cursor. See Panel:SetTooltipPanelOverride if you are looking to override DTooltip itself.
Panel:SetTooltip will override this functionality.
Calling this from PANEL:OnCursorEntered is too late! The tooltip will not be displayed or be updated.
Given panel or the previously set one will NOT be automatically removed.
Arguments
Example
Example usage of this function
local frame = vgui.Create( "DFrame" )
frame:SetSize( 500, 500 )
frame:Center()
frame:MakePopup()
local panel = vgui.Create( "Panel" )
panel:SetSize( 100, 100 )
panel:SetVisible( false )
panel.Paint = function( self, width, height )
surface.SetDrawColor( 255, 0, 0 )
surface.DrawRect( 0, 0, width, height)
end
local button1 = vgui.Create( "DButton", panel )
button1:SetText( "test" )
button1:SetSize( 50, 50 )
button1:SetPos( 5, 5 )
local button2 = panel:Add( "DButton" )
button2:Dock( TOP )
-- button2:SetTooltip( "test" ) -- This will stop SetTooltipPanel from working.
button2:SetTooltipPanel( panel )