Page 1 of 1

application.closeSolution load a new solution with a method

PostPosted: Tue May 20, 2008 10:53 am
by axterics
Function closeSolution
Description Closes the currently open solution; can also include an argument to load (and open) a
specified solution when the currently active solution is closed.
Syntax
application.closeSolution([solution_to_load],[method],[argument]
)
Parameters
solution_to_load - the specified solution to load when the currently active
solution is closed; optional.
method - the specified method run from the currently active solution; optional.
argument - the argument for the specified method; optional.


application.closeSolution([solution_to_load],[method],[argument]
)

[method],[argument] are referred to the currently open solution (I can't understand why, I can simply call a method before call the closeSolution)

My feauture request is to change this behaviour and open the method in the solution that I go to load as first argument.

Anyone interested?
Do you confirm this behavior?

PostPosted: Tue May 20, 2008 12:52 pm
by Harjo
As far as I know, the information is not right, the method and the arguments are for the new opened solution.

We use it that way, and it just works.

Did you already tried it?

PostPosted: Wed May 21, 2008 9:49 am
by axterics
Harjo how do you pass the method and arguments? The method must be global?

I use
application.closeSolution('mySolution', 'forms.myForm._dev_test', 'test')

where forms.myForm._dev_test simply do a plugins.dialogs.showInfoDialog('',arguments[0])

and the mySolution is loaded but no msgbox appear...

PostPosted: Wed May 21, 2008 10:10 am
by ROCLASI
Hi axterics,
axterics wrote:application.closeSolution('mySolution', 'forms.myForm._dev_test', 'test')

Method objects are usually passed without using quotes.
So your code should probably look like this:
Code: Select all
application.closeSolution('mySolution', forms.myForm._dev_test,  'test')


Hope this helps.

PostPosted: Wed May 21, 2008 5:10 pm
by axterics
Without quote:

The undefined value has no properties calling _dev_test.

PostPosted: Wed May 21, 2008 8:35 pm
by grahamg
Have you tried setting the form name into a variable first - seem to recall this worked for me in a similar situation:

Code: Select all
var vFormName = 'forms.myForm._dev_test';

application.closeSolution('mySolution', vFormName,  'test')

PostPosted: Wed May 21, 2008 9:49 pm
by ROCLASI
Hmm..I can't get any method to trigger using this function. String, variable, form method, global method or otherwise.
I tested this on Servoy Version 3.5.6-build 519, Java version 1.5.0_13-119 (Mac OS X) and Java version 10.0-b19 (Windows XP).

Harjo, do you use the method part of this function and if so does it work for you ?

PostPosted: Thu May 22, 2008 9:38 am
by Harjo
I have build this in Servoy 3.1.6

Code: Select all
application.closeSolution('myOtherSolution','GetCookie', 543671); //Attention: calling arguments only work in client!!


and it works! :-)

PostPosted: Thu May 22, 2008 10:23 am
by axterics
Your 'GetCookie' function is on the the "First Form" of the new loaded solution?

Can you test this on a 3.5.x version?

Can you call a function that simply do a plugins.dialog.showInfoDialog('',arguments[0])
in either servoy version?

PostPosted: Thu May 22, 2008 10:26 am
by Harjo
no, getCookie is a global method!

I can't test this right now on 3.5, sorry.....

PostPosted: Thu May 22, 2008 12:14 pm
by axterics
SOLVED.
Works also in 3.5.x release.
The method (e.g. GetCookie) must be a global method in the new loaded solution.


Code: Select all
application.closeSolution('myOtherSolution','GetCookie', 543671);


ATTENTION
Don't work in developer where the new solution appear but without calling any method whereas works perfectly on Servoy client.


If someone can move this thread in the section developer.methods I think can be useful for the future