Home › Forums › General XMetaL Discussion › How to show XFT non-modal › Reply To: How to show XFT non-modal
Reply to: How to show XFT non-modalJuly 22, 2011 at 11:15 pm
You can try this undocumented and currently unsupported solution:
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.