application.showFormInDialog

when I call application.showFormInDialog is there a way to wait untill the box is closed before continuing execution of the method that called it?
eg:
while (application.showFormInDialog)

The function returns void so I doubt this is possible.

It may already do this, but since the dialog is Modal, The method editor stops responding. I can’t tell if it’s waiting or not.

Yes, the method will continue to execute if there is code after the application.showFormInDialog.

Try this code:

application.showFormInDialog(forms.messages,  -1,-1,-1,-1, 'Tester', false, false, true);

plugins.dialogs.showInfoDialog( 'After Close',  'This is after show dialog',  'OK')

Cheers,

Bob Cusick

Wow! This will save me a lot of time…

I have this reusable piece of logic in FileMaker which relies on a ‘Pause’ command to wait for some user input before setting some globals and resuming execution of the script it was originally called from – Had not yet worked out how to do this in Servoy since there is no indefinite ‘Pause’ command in Servoy.

Thanks Bob and wgknowles!

Great thanks Bob,

Now, Does anyone know if on the form in the dialog I have a save button. Will the method that opened the form finish before executing the button’s method?

I figure that the entire method is pushed on the stack before the form ever even shows.

Yes, any methods that you call from the dialog will execute first.

The calling method will only continue when the dialog is closed.

Bob

Very Interesting,

This is not your typical linear programming environment at all then! :idea:

Dialogs are becoming my best friend rather quickly!

Error Log.txt (16 KB)

OK, I know why I couldn’t get this to work the first time round. Since my dialog is called from numerous locations/contexts, I wanted to encapsulate a bit more to avoid having the

application.showFormInDialog

all over the place, so I put it into its own method.

We have the following situation:

Methods A calls Method B
Method B calls application.showFormInDialog and returns some result to the A Method.
Method C is attached so some button on the form and closes the dialog.

It looks like Method A calls Method B, then finishes execucting. Method B will wait for Method C to close the dialog before continuing.

Is this the expected behaviour? I was hoping Method A would wait for Method B to finish…

I agree the syntax for showformindialog() is a bit hairy.

In your post you made no mention of any plugins.dialogs.showInfoDialog()
This is the key to pausing execution of a method.

It looks like Method A calls Method B, then finishes execucting. Method B will wait for Method C to close the dialog before continuing.

method B will finish executing right away without showInfoDialog()
what you might want to try is when you call method B from method A:

while(!(method.B)){}

make sure you return something in method b!!

wgknowles:
In your post you made no mention of any plugins.dialogs.showInfoDialog()

I thought that displaying that dialog was Bob’s way proving that the line executes afterwards…

I replaced it with some other code and it worked fine until I added the extra encapsulation method (A)

Now, using your idea of returning something from method “B” if works fine, it work with a simple assignment

x = B();

don’t think you need to while loop.

don’t use:

while(!methodB())

for delaying something or what ever!!!

because this will completely block the ui and the CPU usage will go to the roof… if methodB doesn’t show a dialog or something like that and returns false every time.

Stalling things should be done with application.updateUI()

but with the example given above this isn’t needed anyway. Because dialogs that are shown (formdialog or dialogs from the dialog plugin) are always modal. And if you have modal dialogs then the script will stop running on the line you call to show it.

on this subject, sort of, i’d like to put up a message
window in front of the current form, letting the user
know we’re doing some time-consuming task.

when that task is complete, i want to close that window,
without any user interaction.

i can’t seem to do this with showFormInDialog though.

is there a way to do this?

thanks in advance.
rm.

you can do that with showFormInDialog
But then you have to do the time consuming stuf in the onShow of the form you show in that dialog

i see; sort of.

does this mean that closeFormDialog can only be called
from the OnShow method of the form that’s being shown
in the dialog?

or any other method that is triggerd by that form
like a method that is attached to the button OK
(which you enaled of everything is done)

I don’t know what exactly would happen if you close the form dialog again in a onShow method (because you are in the on show flow where you suddenly close it again)

i’m seeing a new problem in this area;

i use showFormInDialog to implement a very simple
password scheme.

suddenly, i find that the password dialog (created with showFormInDialog)
is no longer modal; in other words, i call application.showFormInDialog(),
the dialog shows, but before the user does anything else, showFormInDialog() returns to my code!

quitting & restarting servoy solves the problem. closing & reopening
the solution does not.

using 2.0.3 build 276.

that is impossible we always start modal.
The dialog keeps staying?
you can access the main and the dialog form at once?
Can you upgrade to 2.1?

It would be nice if when calling up a dialog using showFormInDialog() I could return a value from the dialog (based on the user’s choice in the dialog) using a “return” statement rather than a global. Is that possible?

that is impossible we always start modal.

On a related note: It would be useful to call an FID from an FID, and show them as stacked. It does not appear to be supported at this time. Any plans for such in the near future? I am reaching back to FMP-think for workarounds, and would rather not!

Thanks,

Jim

Yes, that’s indeed a long wish.
As far as I could remember, Johan would make it better in Servoy 3.

I have a navigation controller that displays different listings (queues)when selected buttons are selected

On the listing forms I have an onShow event that does a search for specific records.

I have another button on the controller that opens a FID search form. The search fields are all global in the FID.

When the search is completed from the FID, a results listing is displayed

If I am on one of my queue listings, and open the FID search and run the search:

application.closeFormDialog()
forms.EquipManagerPurchaseEvalSearchListing.controller.show()
controller.find()
evaluation_number = globals.Text1;
recived_by_account_id = globals.Integer1;
equipment_classifcation = globals.Text3;
if (globals.Text5)
{
manufacturer = ‘%’ + globals.Text5 + ‘%’;
}
if (globals.Text6) {
model = ‘%’ + globals.Text6 + ‘%’ ;
}
if (globals.Text7) {
serial_number = ‘%’ + globals.Text7 + ‘%’;
}
controller.search();

I cant keep the onshow method on the queue form… form running when the FID is closed. So I have to open the FID and run the search again and it works.

How can I close the FID and perform the search and display a differnt form. I cannot run the FID search as an Onshow event of the search result listing form.

Tbanks,
Erich