How to Load HTML in Chrome OnReady Event
Description
Learn how to add HTML to a Chrome window launched using Xdialog and Chrome's onReady event.
Discussion
Consider the following simple Xdialog that displays some HTML in Chrome control:
dim cr as helper::Chrome cr.html = "HTML to show" dim dlg_title as c dlg_title = "Chrome Xdialog" ui_dlg_box(dlg_title,<<%dlg% {chrome=100,20cr} %dlg%,<<%code% %code%)
This Xdialog will render as follows:
In some cases, however, because of timing problems, the Xdialog window will open, but the Chrome control will not be properly populated.
The Xdialog can be restructured so that the HTML is only loaded into the Chrome control when its OnReady event fires:
dim html as c html = <<%html% <p>HTML - loaded in the Chrome onReady event</p> %html% dim cr as helper::Chrome cr.html = "Dummy Content" dim dlg_title as c dlg_title = "Chrome Xdialog" cr.OnReady = "ui_dlg_event("+quote(dlg_title)+",\"chromeReady\")" ui_dlg_box(dlg_title,<<%dlg% {chrome=100,20cr} %dlg%,<<%code% if a_dlg_button = "chromeReady" a_dlg_button = "" cr.html = html end if %code%)
Limitations
Desktop Applications Only