Revision Difference
Panel:SetTooltipPanel#529094
<function name="SetTooltipPanel" parent="Panel" type="classfunc">
<description>
Sets the panel to be displayed as contents of a <page>DTooltip</page> when a player hovers over the panel object with their cursor. See <page>Panel:SetTooltipPanelOverride</page> if you are looking to override <page>DTooltip</page> itself.
<note><page>Panel:SetTooltip</page> will override this functionality.</note>
⤶
<warning>Calling this from <page>PANEL:OnCursorEntered</page> is too late! The tooltip will not be displayed or be updated.</warning>⤶
<warning>Given panel or the previously set one will NOT be automatically removed.</warning>⤶
⤶
<warning>⤶
Calling this from <page>PANEL:OnCursorEntered</page> is too late! The tooltip will not be displayed or be updated.⤶
⤶
Given panel or the previously set one will **NOT** be automatically removed.⤶
</warning>⤶
</description>
<realm>Client</realm>
<args>
<arg name="tooltipPanel" type="Panel" default="nil">The panel to use as the tooltip.</arg>
</args>
</function>
<example>
<description>Example usage of this function</description>
<code>
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 )
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 )⤶
</code>
⤶
</example></example>