check if form is loaded

Questions, tips and tricks and techniques for scripting in Servoy

check if form is loaded

Postby Hans Nieuwenhuis » Fri Apr 29, 2011 1:48 pm

Hi,

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

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if form is loaded

Postby patrick » Fri Apr 29, 2011 2:03 pm

shouldn't that be in History?
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: check if form is loaded

Postby pbakker » Fri Apr 29, 2011 2:23 pm

Code: Select all
if ("formName" in forms) {

}


Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: check if form is loaded

Postby patrick » Fri Apr 29, 2011 2:43 pm

but that would be true for any form in the solution, loaded or not, no?
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: check if form is loaded

Postby mboegem » Fri Apr 29, 2011 2:56 pm

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)
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: check if form is loaded

Postby Hans Nieuwenhuis » Fri Apr 29, 2011 2:59 pm

you're right Patrick.

The code from Paul always returns true if the form exists.
It does not look at the "loaded state"
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if form is loaded

Postby patrick » Fri Apr 29, 2011 3:04 pm

but it should be in the history stack...
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: check if form is loaded

Postby Hans Nieuwenhuis » Fri Apr 29, 2011 3:12 pm

Close,

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

Thanks Patrick.
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if form is loaded

Postby pbakker » Fri Apr 29, 2011 3:17 pm

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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: check if form is loaded

Postby patrick » Fri Apr 29, 2011 3:41 pm

Ah, right!
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: check if form is loaded

Postby Hans Nieuwenhuis » Fri Apr 29, 2011 3:45 pm

+1

Thanks Paul
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if form is loaded

Postby Hans Nieuwenhuis » Wed Apr 17, 2013 8:14 pm

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,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if form is loaded

Postby pbakker » Thu Apr 18, 2013 9:04 am

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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: check if form is loaded

Postby Hans Nieuwenhuis » Thu Apr 18, 2013 10:37 am

Paul,

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

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 6 guests