Form life span problem...

Here is what I would like to do. On the OnPush event of a button I would like to Run another form (Child) and Close the Current Form (Parent). The problem I am having is the child form is closed at the same time the Parent form. I suppose that the scope of the Child form is only within the Parent, which is why they are closed at the same time. Has anyone found a way around this? Thanks, Keith Reichert

Guess this is not possible. Like if you close your main menu, all child windows are closed too. Any hints to this issue? Soren Nielsen, moderator Integration/Developer NOLUG

Couldn’t you RUNMODAL the child form, design it larger than the parent form, and then close both forms when the child is closed?

If you use RUNMODAL and then CurrForm.CLOSE, the child form will stay and when closed both forms will close: example on button: onpush() FORM.RUNMODAL(FORM::“mytestform”); CurrForm.CLOSE; this will open mytestform and when closed mytestform both forms will be closed automatically. – Alfonso Pertierra Spain

Alfonso - You also need to set the PushAction on the “OK” button to i.e. “Yes”.


Settings The PushAction settings are: To have the system perform this action… Choose… Close form and return OK OK Close form, do not return OK Cancel Close lookup form and return OK LookupOK Close lookup form, do not return OK LookupCancel Return Yes Yes Return No No Close the form Close Stop processing Stop Show help for this form FormHelp Run an application object RunObject Run a system command (external program) RunSystem Perform a lookup into the current table LookupTable

The reason for this, is that if you chooses one that closes the form, you get errors. - Especially when you also do a Currform.close anyway ___________________ Kind regards, Henrik Helgesen, Moderator Danish

Could use onpush() CurrForm.VISABLE:=FALSE; FORM.RUNMODAL(FORM::“mytestform”); CurrForm.CLOSE; Then the calling form is not visable although it is still running. IMPORTANT Don’t forget the close after running the form as you will have an invisable form running on the system.

Brilliant idea, Paul - Never thought of that :slight_smile: Kind regards, Henrik Helgesen _________________ Kind Regards – Henrik Helgesen, moderator Danish


I would like to Run another form (Child) and Close the Current Form (Parent).

A form started from a parent form belongs to the parent and is automatically disposed if the parent is closed. You might not be aware of it but every field or label of a form is a child object too. They all follow the same rule. Therefore what you want to achieve is technically impossible. You might want to use a codeunit which starts both forms in a sequence. Such as Runmodal(form.A) Runmodal(form.B) In this case both forms are on equal level and are children of the main form. ------- With best regards from Switzerland Marcus Fabian