Garry's Mod Wiki

DHTML

DHTML

List of hooks for DHTML Panels.

Events

DHTML:OnBeginLoadingDocument( string url )
Called when this panel begins loading a page.
boolean DHTML:OnCallback( string library, string name, function callback )
Called by the engine when a callback function is called.
DHTML:OnChangeTargetURL( string url )
Called by HTML panels when the target URL of the frame has changed, this happens when you hover over a link.
DHTML:OnChangeTitle( string newTitle )
Called by HTML panels when the title of the loaded page has been changed.
DHTML:OnChildViewCreated( string sourceURL, string targetURL, boolean isPopup )
Called by HTML panels when the page attempts to open a new child view (such as a popup or new tab).
DHTML:OnDocumentReady( string url )
Called by HTML panels when the panel's DOM has been set up. You can run JavaScript in here.
DHTML:OnFinishLoadingDocument( string url )
Called when this panel successfully loads a page.

Methods

DHTML:AddFunction( string library, string name, function callback )
Defines a Javascript function that when called will call a Lua callback. Must be called after the HTML document has fully loaded.
DHTML:Call( string js )
Runs/Executes a string as JavaScript code in a panel. This function does NOT evaluate expression (i.e. allow you to pass variables from JavaScript (JS) to Lua context).Because a return value is nil/no value (a.k.a. void).If you wish to pass/return values from JS to Lua, you may want to use DHTML:AddFunction function to accomplish that job.This function is an alias of DHTML:QueueJavascript (source).
DHTML:ConsoleMessage( string msg )
Called when the page inside the DHTML window runs console.log. This can also be called within the Lua environment to emulate console.log. If the contained message begins with RUNLUA: the following text will be executed as code within the Lua environment (this is how Lua is called from DHTML windows).
boolean DHTML:GetAllowLua()
Returns if the loaded page can run Lua code, set by DHTML:SetAllowLua
DHTML:QueueJavascript( string js )
Runs/Executes a string as JavaScript code in a panel. This function does NOT evaluate expression (i.e. allow you to pass variables from JavaScript (JS) to Lua context).Because a return value is nil/no value (a.k.a. void).If you wish to pass/return values from JS to Lua, you may want to use DHTML:AddFunction function to accomplish that job.If Panel:IsVisible is false, PANEL:Think will NOT run, meaning the Javascript Queue will not be processed.Consider overriding PANEL:Paint to stop the panel from drawing..
DHTML:SetAllowLua( boolean allow = false )
Determines whether the loaded page can run Lua code or not. See DHTML for how to run Lua from a DHTML window.
DHTML:SetScrollbars( boolean show )
We advise against using this. It may be changed or removed in a future update. Broken. Use the CSS overflow rule instead. Sets if the loaded window should display scrollbars when the webpage is larger than the viewing window. This is similar to the CSS overflow rule.
DHTML:StopLoading()
Stops the loading of the HTML panel's current page.

Special Pages


Wikis

?

Render Time: 67ms

DB GetPage 39
Generate Html 2
SaveChanges (1) 17
Render Body 0
Render Sidebar 6