Recent

Author Topic: Show a form from another.  (Read 3239 times)

Sora-Kun

  • Full Member
  • ***
  • Posts: 162
  • I can smell your presence ...
    • Sora-Kun
Show a form from another.
« on: September 06, 2010, 09:12:35 pm »
Hi,
i have two forms called respectively "form1" and "form2", with the next unit names "main_unit", "unit1".
I want to show the "form2" from the "Form1" which is the main form.
Please not that the 'form2' will apply some changes to the objects on the "form1".
Please Help !
Thanks a lot  :)
if nothing suites you, make it your self!
The Revolution, Genesis. The next generation IDE.
If you want to help, PM me.

Made in Lazarus.
Soon, in The WWW.

Yogi

  • New Member
  • *
  • Posts: 42
Re: Show a form from another.
« Reply #1 on: September 06, 2010, 09:51:05 pm »
perhaps like this?

form2:=tform2.create(nil);
form2.showmodal;
form2.free

be sure the changes you do in form2 on formmain dont destroy anything

Lazarus 1.3 SVN 44197 * FPC 2.7.1 SVN 26822
Linux: 3.2.0-4-686-pae * Debian wheezy
Windows: W98

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Show a form from another.
« Reply #2 on: September 06, 2010, 11:05:24 pm »
Normally Forms added in the IDE are already created but not shown.

so in main_unit add "uses unit1;"
Then Form2.Show or Form2.ShowModal should be enough.
If you need to change values in main_unit, add
"uses main_unit;" in unit1 below the implementation keyword.

 

TinyPortal © 2005-2018