Causes a RichText element to scroll to the top of its text.
Example
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 panellocal richtext =vgui.Create("RichText", TextFrame)
richtext:Dock(FILL)
-- Yellow colored localized text about player capacityrichtext:InsertColorChange(255, 255, 192, 255)
richtext:AppendText("#ServerBrowser_ServerWarning_MaxPlayers")
-- Create a button that moves the text back to the startlocal 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 fontfunctionrichtext:PerformLayout()
self:SetFontInternal("Trebuchet18")
self:SetBGColor(Color(64, 64, 84))
end