Switch to main window

Questions, tips and tricks and techniques for scripting in Servoy

Switch to main window

Postby irenem » Thu Aug 26, 2010 11:18 am

I wander if it is possible to run a method from a FormInWindow or dialog that affects only the main window.

In my method I try to switch to the main window first, but without success because the context of the main window is null.

Does anybody know the trick?
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: Switch to main window

Postby pbakker » Thu Aug 26, 2010 12:26 pm

What do you mean with "affects only the main window"?

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

Re: Switch to main window

Postby irenem » Thu Aug 26, 2010 12:33 pm

The FID is a toolbar with buttons. It is always on top of the main application window. When I click on a button I would like to fire a method on the forms shown in the main application window.
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: Switch to main window

Postby pbakker » Thu Aug 26, 2010 8:22 pm

So, what is the issue exactly then? Can't you just fire the right method on the right form?

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

Re: Switch to main window

Postby irenem » Thu Aug 26, 2010 8:53 pm

With my button on the FID I want to switch to another layout on the main window, but when I fire the method it switches to the layout on the FID.

The problem is that I don't know how to tell the method that he has to activate the main window first, and then to switch the layout.
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: Switch to main window

Postby pbakker » Thu Aug 26, 2010 9:04 pm

There are several functions to show a form (on the controller of a form and under the application node) and I think all have the ability to supply the name of the "dialog/window" in which to show the form.

If you want to target the main window, use a null value as dialog/window name and then it should target the main window.

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

Re: Switch to main window

Postby irenem » Thu Aug 26, 2010 9:25 pm

I try to use:

forms.nav_user_main.controller.show("null",false)

it goes on the right layout but it opens another window.

I already looked in applications but the method " application.isFormInDialog" is deprecated.

Any suggestions?
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: Switch to main window

Postby pbakker » Thu Aug 26, 2010 9:29 pm

You're giving it a String with value "null", not a null value :-)

Try forms.nav_user_main.controller.show(null,false)

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

Re: Switch to main window

Postby irenem » Thu Aug 26, 2010 9:37 pm

Brilliant you, stupid me :oops:

thank you for waking me up
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 5 guests

cron