Nested formInDialog, weird execution of code

We make a thorough use of formInDialog in our solutions, but we only implement nested (multiple level) formInDialog recently.
The manual state that the method which calls formInDialog is halted until dialog is closed.
This assertion is true only for first level call of the function, as a matter of fact, if you call a formInDialog from a method inside a dialog, the method is not halted by calling formInDialog.
Please confirm us either if it is a bug or a ‘feature’ as we ought to know it before coding these parts of our solutions. We can manage either comportement, but need to know ASAP if it will be corrected or not.

Example(pseudo-code): Form A calls dialog B, In B, a button call dialog C

application.showFormInDialog(forms.B);  
... press button ...
application.showFormInDialog(forms.C);
application.beep();

As soon as you press the button, dialog C opens, …and you here the beep.

Bug happens in 2.2 b3 and 2.2 rc1

Your conclusions are right!
This is how it works right now!

This also reported several times. Don’t know it they can fix it.

Johan/Jan? Can this be fixed?

Hi servoy team,

Please can you just confirm if this is a bug or a feature?

I need to know if you intend to address this issue or not as we have several solutions in the pre-release state.

Your answer can save us a lot of time, please.

The conclusion of HJK is correct and as far as I know Servoy won’t be able to solve this on short notice.

What you should do is bring the code that you run AFTER opening the 2nd dialog to that 2nd dialog and run it there after completing what needs to be done…

That’s how it works right now.

IT2BE:
The conclusion of HJK is correct and as far as I know Servoy won’t be able to solve this on short notice.

Thank you Marcel, I will go ahead with our projects, taking this as a ‘feature’ - code execution is blocked when calling FIRST level formInDialog- have a nice day.

I am not sure I fully understood of how that works right now. I have a similar problem that goes like this:

  • on a formInDialog I have a button that has method “A” attached, which shows another formInDialog
  • on this form the user chooses a record or doesn’t
  • if he does, the ID of the chosen record is put in a global
  • method “A” is supposed to check for the global and continue to do things

The problem is that it doesn’t continue to do things after the second dialog is closed. If the debugger is turned on, though, it does continue.

Here is the code (more or less):

globals.result = null;
forms.abc.showDialog();

if (!globals.result) {
	return;
}
else
{
	application.output('I made it') // this is never reached!?
}

one more thing: as far as I understood this, the code that comes last has to be executed from the second form that is shown. This is not really possible/wanted in my case, because the second dialog is used in many occasions. If the code I put here does not work, I will need to pass the name of that method to the second dialog, which I think is pretty ugly.

Could anyone clarify on how that is supposed to work? I don’t want to implement rather stupid workarounds for something that might be fixed in the next build…

I will need to pass the name of that method to the second dialog, which I think is pretty ugly.

Huh, why?

If you want to use that dialog in more than one occasion the above is the way to right now…

patrick.. As it is said in this thread..
The second form dialog you show is NOT blocking.. So the code will be directly exectued when you show a dialog in a dialog..
So yes youre globals.var is never filled in when executing that code if you do call it from a dialog already.

I am having a slow day… :roll:

If I understand right, I set the global to null, show a dialog to fill the global, but I run directly to the end of the originating method?

So do you have an idea of how one can implement an independent selection dialog (a form that presents records, you click on one, the ID is put somewhere)?

Thanks for your patience…

If I understand right, I set the global to null, show a dialog to fill the global, but I run directly to the end of the originating method?

Yes but only if you show a dialog in a dialog then this is the case. Not when main->dialog.

So if you independent selection dialog is shown as the second dialog then you have call back from the onHide of that form you show in youre selection dialog. There is currently no other way.

We will see if we can make an option to create another formdialog everythime you want to show one more in a dialog (so that all other form dialogs are staying where they are)

So you mean you have to do something like:

// show the second dialog and save the method to a global
globals.method = aMethod
forms.dialog.showDialog()

and then attach to the button that closes the second dialog (or onHide)

eval(globals.method)

That’s what I do now. It’s not a real beauty, is it?

We will see if we can make an option to create another formdialog everythime you want to show one more in a dialog (so that all other form dialogs are staying where they are)

As far as I understand that also means that the first dialog stays visible? That is a much requested feature anyway, I think that would be very useful!