Harry,
I’ll try to post a small sample solution asap. In the meantime, this is some of the code I use:
To open the first form (fm_chgFormWin, a form with 4 buttons to open other forms) in a non modal window:
application.showFormInDialog(forms.fm_chgForm,-1,-1,-1,-1,"Choose Form",false,false,"win_fm_chgForm",false);
(this method is fired by clicking on the splash screen of the first form of the solution)
Associated to the onShow event of this first form is a global method which is also associated to the onHide event of all the forms opened by the first form. This method toggles the enabled state of the buttons of the first form: if a form is opened in a window, the respective button is not enabled
for(var g in forms.allnames)
{
//if the form is open the button is not enabled and the text changes color to gray
if(application.isFormInDialog(forms.allnames[g]) && forms.allnames[g].substr(3,2) == "bt")
{
forms.fm_chgForm.elements["bt_" + forms.allnames[g].substr(6)].enabled = false;
forms.fm_chgForm.elements["bt_" + forms.allnames[g].substr(6)].fgcolor = "#cccccc";
}
//if the form is closed the button is enabled and the text changes color to red
else if(forms.allnames[g].substr(3,2) == "bt")
{
forms.fm_chgForm.elements["bt_" + forms.allnames[g].substr(6)].enabled = true;
forms.fm_chgForm.elements["bt_" + forms.allnames[g].substr(6)].fgcolor = "#ff0000";
}
}
Each button of the first form is named according to the forms to be opened, (e.g. form “fm_bt_warehouses” is opened by the button “bt_warehouses”) and has the following method associated
application.showFormInDialog(forms["fm_" + application.getMethodTriggerElementName()],-1,-1,-1,-1,"Form " + application.getMethodTriggerElementName(),true,false,"win_fm_" + application.getMethodTriggerElementName(),false);
//set the button state according to the open forms
globals.gb_mt_showHide();
I should add to my previous post, that if I use a method to close the forms, the behavior is the same of clicking on the close button of the form.