05-04-2022, 12:13 AM
(This post was last modified: 05-04-2022, 12:36 AM by Alexandre Machado.)
I suggest that you refactor your application and change your form creation code... something like this:
WebApplication->ShowForm(TIWForm1, false, true); // in c++
TIWApplication.ShowForm() method has 3 parameters (the last 2 are optional)
First parameter is the Class of the form
Second parameter (AReleaseActiveForm: boolean), when true, the "old" form will be released when the "new" form becomes active. Default is false
Third parameter (AUseExistingInstance: boolean), when true, any existing instance of the same class of the desired form will be used. Default is false.
When you call it like
WebApplication->ShowForm(TIWForm1, false, true);
IW will create a new TIWForm1 instance and make it active (not releasing the old one) but if there is already an instance created, it will be used instead. This code guarantees that no 2 instances of any form class will ever exist (as long as you use this same method everywhere, instead of creating the forms via traditional code)
It will handle nicely all these cases that you are referring to
Handling the navigation between forms, including the back button events, is sometimes hard to get right. I'll check your updated example and propose a few modifications to handle it better, if that's the case.
Kind regards
WebApplication->ShowForm(TIWForm1, false, true); // in c++
TIWApplication.ShowForm() method has 3 parameters (the last 2 are optional)
First parameter is the Class of the form
Second parameter (AReleaseActiveForm: boolean), when true, the "old" form will be released when the "new" form becomes active. Default is false
Third parameter (AUseExistingInstance: boolean), when true, any existing instance of the same class of the desired form will be used. Default is false.
When you call it like
WebApplication->ShowForm(TIWForm1, false, true);
IW will create a new TIWForm1 instance and make it active (not releasing the old one) but if there is already an instance created, it will be used instead. This code guarantees that no 2 instances of any form class will ever exist (as long as you use this same method everywhere, instead of creating the forms via traditional code)
It will handle nicely all these cases that you are referring to
Handling the navigation between forms, including the back button events, is sometimes hard to get right. I'll check your updated example and propose a few modifications to handle it better, if that's the case.
Kind regards