Panel.SetHTML

From GMod Wiki

Jump to: navigation, search
Function
Syntax Panel:SetHTML( String HTML code )
Description:
Instructs an HTML control to parse a string of HTML code directly.
Returns: nil
In Object: Panel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Panel.SetHTML]Panel.SetHTML [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a HTML panel.
Used onNewerClient.png
Code
local html = vgui.Create( "HTML", DPanel)
html:SetHTML( "<p>Use your html here!</p>" )
html:SetSize( 390, 400 )
OutputA HTML panel ready for use.


DescriptionA simple MOTD
Used onNewerClient.png
Code
 
local MOTDFrame = vgui.Create( "DFrame" )
MOTDFrame:SetTitle( "Message of The day" )
MOTDFrame:SetSize( ScrW() - 100, ScrH() - 100 )
MOTDFrame:Center()
MOTDFrame:SetBackgroundBlur( true )
MOTDFrame:MakePopup()
 
local MOTDHTMLFrame = vgui.Create( "HTML", MOTDFrame )
MOTDHTMLFrame:SetPos( 25, 50 )
MOTDHTMLFrame:SetSize( MOTDFrame:GetWide() - 50, MOTDFrame:GetTall() - 150 )
MOTDHTMLFrame:SetHTML( file.Read( "folder/file.txt" ) )
 
OutputIf you link this to a usermessage and a couple of hooks, a working MOTD.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox