General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion How to show XFT non-modal

  • spyro

    How to show XFT non-modal

    Participants 1
    Replies 2
    Last Activity 11 years, 6 months ago


    how can I show a XMetaL form non-modal (the XMetaL mainwindow is still alive, scrolling possible etc.)?

    I only can find this method:

    Set dlg=Application.CreateFormDlg(application.Path & “StartUpxpath.xft”)

    which freezes the main window.

    (XMetaL 5.5)

    Thank you,


    Derek Read

    Reply to: How to show XFT non-modal

    You can try this undocumented and currently unsupported solution:

    [code=JScript example]
    var XftCtrl = new ActiveXObject(“XF.XFTForm”);
    var formPath = Application.Path + “\Forms\myform.xft”;
    /*following line tries to kill the form if it is launched
      a second time, however, the JScript engine decides
      when this cleanup actually occurs*/
    nonmodalDlg = null;
    nonmodalDlg = XftCtrl.StartForm(formPath, 0);
    XftCtrl = null;[/code]

    You have to be careful with the code you run inside a dialog launched this way. Most XFT forms ultimately make a change to the current document when the user dismisses them. Depending on what your dialog does you may need to take into account the fact that the user may be able to perform some or all of the following actions after launching and while interacting with your form:

      1) Close the current document.
      2) Switch to or open another document.
      3) View the current document using another view (of the 4 available).
      4) Change the selection in the current document.
      5) Delete the current selection.
      6) Cut or copy the current selection or paste over it.
      7) Add additional markup or text into or around the current selection.
      8) Run a macro.
      9) Launch another XFT form.
      10) Open and interact with other portions of the XMetaL Author application (Attribute Inspector, Element List, Spell Checker, etc).

    Depending on what your form does this might add an order of complexity to any code you write in order to catch every possible scenario a user might perform that would break your code. Also depending on what your form needs to do it might not make sense to allow the user to run it this way.



    Reply to: How to show XFT non-modal

    Hello Derek Read,

    thanks for your quick reply.

    I had to change your code in the following VBS syntax for my project:

    set XftCtrl = CreateObject(“XF.XFTForm”)
    formpath = application.Path & “StartUpxpath.xft”
    set nonmodalDlg = nothing
    set nonmodalDlg = XftCtrl.StartForm(formpath, 0)
    Set XftCtrl = nothing[/code]

    It doesn't throw an error and seems to work in the way that it opens the xft. But once  the form is loaded it is closed immediately.



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

Lost Your Password?