Garry's Mod Wiki

DHTML

Description

The DHTML control wraps the internal Awesomium framework, supports calling Javascript functions from Lua, as well as running Lua from within the HTML. Running Lua code is disabled by default.

Parent

Derives from Awesomium.

Example

Creates a DHTML.

local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 200 ) frame:SetTitle( "My new Derma frame" ) frame:SetVisible( true ) frame:SetDraggable( true ) frame:Center() --Fill the form with a html page local html = vgui.Create( "DHTML" , frame ) html:Dock( FILL ) html:SetHTML( [[ <input type='submit' onclick='console.log("RUNLUA:print(\"This is called in Lua context\")")' /> ]] ) --Enable the webpage to call lua code html:SetAllowLua( true ) frame:MakePopup()

Example

Creates a DHTML and opens Google inside.

local frame = vgui.Create("DFrame") frame:SetSize(ScrW() * 0.5, ScrH() * 0.5) frame:SetTitle("HTML Example!") frame:Center() frame:MakePopup() local html = vgui.Create("DHTML", frame) html:Dock(FILL) html:OpenURL("https://www.google.com/")
Output:

Methods

Page Links


Special Pages


Wikis

?

Render Time: 36ms

DB GetPage 3
Generate Html 11
SaveChanges (1) 8
Render Body 0
Render Sidebar 11