Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form create/destroy best practise ?
#1
Hi All,

Usually I have a main form, allowing the user to select  a function, which then will create and show a form. If necessary, that form too, will create a new form, and when user is finished, it is released and the former form is shown again. And when user finishes, clicks a kind of "close" button, that form is finally released and the menu form is back on.

Now I want to call the form create without going back to the former with Release, meaning from the menu a new form (1st.) is created and shown. 1st. form creates and show a new form (2nd.), which again creates and show a form (3rd.). And when the user finished using 3rd. form, I want the program to go straight back to the menu program, bypassing form 2nd and 1st.

How do I do that, making sure all memory is released ?

Regards
Soren
Reply
#2
Hi Soren. Try this:
- from the menu a new form (1st.) is created and shown, DON'T RELEASE menu form.
- 1st. form creates and show a new form (2nd.), RELEASE 1st form.
- which again creates and show a form (3rd.), RELEASE 2nd form.
- And when the user finished using 3rd. form, RELEASE 3rd form.

Only Form Menu is created and not released, IW go back to him when you release 3rd form.
Reply
#3
Hi Jose,

Thank you for your notes. Just to be 100% clear:

In form 1 (and likewise in form 2) I would write:

procedure TForm1.CallNextForm;
begin
TForm2F.create(self).show;
Release;
end;

Regards
Soren
Reply
#4
Exactly.
Reply
#5
Form management is very similar to a normal desktop app. But one has to use Release instead of Free, and the actual release is delayed until control returns from user code to IntraWeb. This is because of how the web works, but its very similar otherwise.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)