Garry's Mod Wiki





Causes a RichText element to scroll to the top of its text.

This does not work on the same frame as Panel:SetText.

Issue Tracker: 2239


Creates a RichText panel with a "Back to Top" button which scrolls the text to the start.

-- Create a window frame TextFrame = vgui.Create("DFrame") TextFrame:SetSize(250, 200) TextFrame:Center() TextFrame:SetTitle("#ServerBrowser_ServerWarningTitle") TextFrame:MakePopup() -- RichText panel local richtext = vgui.Create("RichText", TextFrame) richtext:Dock(FILL) -- Yellow colored localized text about player capacity richtext:InsertColorChange(255, 255, 192, 255) richtext:AppendText("#ServerBrowser_ServerWarning_MaxPlayers") -- Create a button that moves the text back to the start local topbutton = vgui.Create("DButton", richtext) topbutton:SetSize(60, 20) topbutton:SetPos(160, 146) topbutton:SetText("Back to Top") -- When clicked, go to the start of the text topbutton.DoClick = function() richtext:GotoTextStart() end -- Apply background color and font function richtext:PerformLayout() self:SetFontInternal("Trebuchet18") self:SetBGColor(Color(64, 64, 84)) end

Special Pages



Render Time: 19ms

DB GetPage 2
Generate Html 3
SaveChanges (1) 5
Render Body 0
Render Sidebar 6