03-08-2025, 11:57 PM
(This post was last modified: 03-08-2025, 11:59 PM by Alexandre Machado.)
(03-05-2025, 11:54 PM)MJS@mjs.us Wrote: I have a theory on this. I think this code in the IWAppFormCreate event:
Code:wakoForm = new TwakoForm(this);
adrForm = new TadrForm(this);
...
is the problem as it's the C++ way but not the IW way. IW will create these forms on demand by something like WebApplication->GoToURL("/paypalForm") if you use SetURL or WebApplication->ShowForm(__classid(TpaypalForm),false,true), etc.
If you are creating these forms ahead of time to be able to access them via the variables you created for future reference it might just be 'accidentally' working most of the time for you.
If you remove the pre-creating form code from IWAppFormCreate and access your other forms something like this:
Code:TpaypalForm *f = dynamic_cast<TpaypalForm *>(WebApplication->FindFormByName("paypalForm"));
if(f) { f->Show(); } else { new TpaypalForm(WebApplication)->Show(); }
it may always work correctly without affecting the session.
@MJS
your code does almost the same as the WebApplication->ShowForm() does
For all IntraWeb users, both Delphi and C++Builder, I strongly suggest to forget about form variables and always use the WebApplication instance. WebApplication->ActiveForms list always contains the correct reference for each form created in that session context.
BTW, ShowForm() has 2 different overloaded versions:
Code:
ShowForm(System::Classes::TComponentClass AFormClass, bool AReleaseActiveForm = false, bool AUseExistingInstance = false);
ShowForm(const System::UnicodeString AFormClassName, bool AReleaseActiveForm = false, bool AUseExistingInstance = false);In the first version you pass the form class, in the second version you can use the form class name (but you have to register the form class using RegisterClass() function before using it). I personally like the second version because it allows you to create/show a form without the need to reference it's unit

