XMetaL Tips and Tricks

XMetaL Community Forum XMetaL Tips and Tricks Script Example: Internet Explorer WebBrowser Control Embedded in XFT

  • Derek Read

    Script Example: Internet Explorer WebBrowser Control Embedded in XFT

    Participants 1
    Replies 0
    Last Activity 13 years, 1 month ago

    XFT has a lot of the standard controls you would expect to find in such a tool and you can add more provided the controls you add to your form will also be available on your end user's machines.

    However, what if you're really good (or just more comfortable) with DHTML or just prefer the ease and power of styling forms in HTML?

    This example demonstrates:
    1) How to write HTML into the WebBrowser control from a script running in the XFT form so the XFT is fully functional without needing to read in any external HTML files. You could install an HTML file along with the XFT instead but this seems nicer to me (though it means having to double escape some strings).
    2) How to create a 'contract' between the JScript functions in the HTML page and the XFT so that the functions declared in the HTML page can obtain XMetaL Author objects and call their methods.

    The WebBrowser control in this example is hosted in an XFT form, however, it could be hosted in the ResourceManager or perhaps elsewhere. Note that pretty much all Windows machines have to have this control installed as it is used by the Windows operating system itself as well as applications such as Windows Live Messenger, and even XMetaL Author's “Page Preview” view. The only likely difference between machines is the version you might have installed.

    All code is commented inline in the XFT so no detailed explanation is given here. You will of course need to be able to edit XFT forms, which means you will need xflayout.exe (comes with XMetaL Developer). You do not need xflayout.exe to run this example (though if you don't have XMetaL Developer you'll need to manually create an MCR file).

    Installation and Usage:
    1) Save the form to a known location on your machine.
    2) Create an MCR script to launch the form as follows:
    var xftDlg=Application.CreateFormDlg("path to the XFT form here");

    3) Launch XMetaL Author and run the script to launch the form.


  • You must be logged in to reply to this topic.

Lost Your Password?