Page 1 of 1

check if form is loaded

PostPosted: Fri Apr 29, 2011 1:48 pm
by Hans Nieuwenhuis
Hi,

Is there a way to check if a form is already loaded or not ?

Regards,

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 2:03 pm
by patrick
shouldn't that be in History?

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 2:23 pm
by pbakker
Code: Select all
if ("formName" in forms) {

}


Paul

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 2:43 pm
by patrick
but that would be true for any form in the solution, loaded or not, no?

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 2:56 pm
by mboegem
if it helps you: the onShow event of a form has a boolean that indicates whether or not it's the first time show after a load.

Don't know if this information is too late for you (code-wise)

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 2:59 pm
by Hans Nieuwenhuis
you're right Patrick.

The code from Paul always returns true if the form exists.
It does not look at the "loaded state"

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 3:04 pm
by patrick
but it should be in the history stack...

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 3:12 pm
by Hans Nieuwenhuis
Close,

The current form is loaded, but it is not in history,
but I can add that to my own check.

Thanks Patrick.

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 3:17 pm
by pbakker
That code snippet I posted checks the forms array, which contains the actually loaded forms. If you want the full list of forms, you have to go through forms.allnames.

Note: the forms array is special, in the way that when you would do forms.nameOfNotYetLoadedForm, it automatically starts loading the previously not loaded form.

Paul

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 3:41 pm
by patrick
Ah, right!

Re: check if form is loaded

PostPosted: Fri Apr 29, 2011 3:45 pm
by Hans Nieuwenhuis
+1

Thanks Paul

Re: check if form is loaded

PostPosted: Wed Apr 17, 2013 8:14 pm
by Hans Nieuwenhuis
Hi Paul,

Has something changed ?

Code: Select all
if (_inForm in forms)


Now returns forms that the user has not visited yet.

This is in 5.2.15

Regards,

Re: check if form is loaded

PostPosted: Thu Apr 18, 2013 9:04 am
by pbakker
Hi Hans,

No, nothing should have changed. I haven't tested this in 5.2.x, but in 7.x it still works as advertised.

I can't realy believe it would've stopped working though. Are you sure you're testing it ok?

Paul

Re: check if form is loaded

PostPosted: Thu Apr 18, 2013 10:37 am
by Hans Nieuwenhuis
Paul,

Thanks !
Will do some more testing and I'll get back on this.

Regards,