TextControl.Web: Determine when a Document Has Been Completely Loaded
Web.TextControl fires a waitDialogMessageReceived event during document loading. The event detail includes a show property that is true when loading starts and false when loading completes. This allows developers to enable or disable custom UI controls based on the document load state.

Web.TextControl provides an event that can be used to determine when the ribbon bar has been loaded completely in order to add and remove ribbon items such as groups, tabs and buttons.
But when implementing your own file management, it is also very helpful to know when a document has been loaded completely in order to enable or disable specific buttons. Therefore, the opened wait dialog and the registered waitDialogMessageReceived event can be used:
<script type="text/javascript">
document.addEventListener("waitDialogMessageReceived", waitDialogHandler);
function waitDialogHandler(e) {
var msg = e.detail;
if (msg.hasOwnProperty("show")) {
if (msg.show == false) {
// your code here
alert("Loaded!");
}
}
}
</script>
The event is raised twice: At the beginning and at the end of a loading process. The show property is true when a document loading process is started and false when the document has been loaded completely.
Happy coding!
Related Posts
ASP.NETJavaScriptDocument Editor
Detect Toggle Button Changes Using a MutationObserver
This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…
TextControl.Web: Adding Custom Ribbon Tabs
Web.TextControl supports adding custom ribbon tabs through JavaScript DOM manipulation. After the ribbonTabsLoaded event fires, new tab headers and content panels with buttons are injected into…
Building a Touch-enabled Button Bar with Javascript
This sample builds a custom touch-friendly button bar for Web.TextControl using its JavaScript API. HTML input elements styled with CSS replace the desktop ribbon bar. Click events call…
TextControl.Web: Inserting Merge Fields Using Javascript
The hidden JavaScript API in TextControl.Web X12 exposes internal editor commands through the enableCommands function. Calling TXTextControl.sendCommand with the InsertItem command and…
Securing WebSocket Connections in ASP.NET Core using Sec WebSocket Protocol…
This article explores how to secure WebSocket connections in ASP.NET Core applications by utilizing the Sec-WebSocket-Protocol header for authentication and authorization purposes.
