You can check the forms[] to see if a form is loaded. The forms[] only has entries in it for actually loaded forms (contrary to the Array the allNames property on the forms node returns, which contains all forms).
The code below allows you to check the existance of a formName in the forms Array without actually loading it into it:
- Code: Select all
application.output(forms.length);
if ('myFormName2Check' in forms) {
application.output('true')
} else {
application.output('false')
}
application.output(forms.length);
Also, you know about arguments[0] for an onShow event being true of false, depending if the form is shown for the first time, right?
Do note that the onShow event is not the right place to check, because when you touch a form in scripting, it's already loaded (onLoad is fired), but the actual showing of the form can happen at a completely different time (depending when you actually show it).
Determining of a record is already loaded into or not is really doable, I think. Maybe foundset.selectRecord() could work for you, because it only returns true if the record was actually selected and it only is able to select the record if the record is already in memory.