Garry's Mod Wiki

Garry's Mod Wiki

  Panel:InsertClickableTextEnd()

Description

Marks the end of a clickable text segment in a RichText element, started with Panel:InsertClickableTextStart.

Example

Creates a panel with some information on RichText panels along with a click-able link to the RichText page.

-- Create a window frame TextFrame = vgui.Create("DFrame") TextFrame:SetSize(250, 150) TextFrame:Center() TextFrame:SetTitle("RichText") TextFrame:MakePopup() -- RichText panel local richtext = vgui.Create("RichText", TextFrame) richtext:Dock(FILL) -- First segment richtext:InsertColorChange(255, 255, 255, 255) richtext:AppendText("This is a Rich Text panel — a panel used in Source MP's default chat box and developer console.\n\nSee the ") -- Second segment richtext:InsertColorChange(192, 192, 255, 255) richtext:InsertClickableTextStart("OpenWiki") -- Make incoming text fire the "OpenWiki" value when clicked richtext:AppendText("Garry's Mod Wiki") richtext:InsertClickableTextEnd() -- End clickable text here -- Third segment richtext:InsertColorChange(255, 255, 255, 255) richtext:AppendText(" for information on how to use a Rich Text panel.") -- Background color function richtext:PerformLayout() self:SetBGColor(Color(32, 32, 46)) end -- Handle any commands we get from the panel function richtext:OnTextClicked( id ) -- Open the wiki if ( id == "OpenWiki" ) then gui.OpenURL( "/Panel:InsertClickableTextStart" ) end end
Output:

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...