Closing Modeless Dialog Boxes Automatically


In some situations, when you open a modeless Xdialog box from a button or command on a form or browse, you will want the Xdialog box to close automatically when its "parent" form or browse is closes, or looses focus.

This type of behavior is apparent if you open a form and then open (for example), the Find by Key dialog box. Notice that when you close the form, the Find by Key dialog box is automatically closed. However, if you simply give focus to another window, the Find by Key dialog box is hidden, and it reappears when the original form is reactivated. To cause a modeless Xdialog to behave in this manner, you simply follow a special naming convention for the title parameter in the UI_MODELESS_DLG_BOX()command. Set the title to:


where formname is the name of the form that is running, and title is the text that you want to appear at the dialog title.

formname is not the name of the form as it appears in Control Panel. Rather it is the alias of the form once it has been loaded. The Xbasic command, TOPPARENT.NAME()can be used to return the formname of the current form.


Desktop applications only.

See Also