Revision Difference
DHTML#517344
<panel>
<name>DHTML</name>
<parent>Awesomium</parent>
<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.</description>
</panel>
<example>
<description>Creates a DHTML.</description>
<code>
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( [[
&lt;input type='submit' onclick='console.log("RUNLUA:print(\"This is called in Lua context\")")' /&gt;
]] )
--Enable the webpage to call lua code
html:SetAllowLua( true )
frame:MakePopup()
</code>
</example>
<example>
<description>Creates a DHTML and opens Google inside.</description>
<code>
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/")
</code>
<output>&lt;br&gt;&lt;br&gt;A <page>DFrame</page> with a DHTML opening Google inside.</output>
<output>&lt;br&gt;<image src="dhtmlexample1.png"/>&lt;br&gt;A <page>DFrame</page> with a DHTML opening Google inside.</output>
</example>
# Methods
* <page>OnCallback</page>
* <page>GetScrollbars</page>
* <page>SetHTML</page>
* <page>OnBeginLoadingDocument</page>
* <page>OnFinishLoadingDocument</page>
* <page>OnDocumentReady</page>
* <page>OnChildViewCreated</page>
* <page>OnChangeTitle</page>
* <page>OnChangeTargetURL</page>