Revision Difference
Panel:SetTooltipPanel#510832
<function name="SetTooltipPanel" parent="Panel" type="classfunc">⤶
<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 <page>DTooltip</page> panel.⤶
⤶
<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>⤶
</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 )⤶
</code>⤶
⤶
</example>