Recent

Author Topic: showing a form  (Read 7078 times)

mirttex

  • Guest
showing a form
« on: August 15, 2005, 07:25:31 pm »
hi this is a newbie and easy question (I guess) but Im not having succes with opening another form. I used to prograns on VB6 but the sintax like formX.show doesn't work in here :-( , of course. so if anyone cold put the code here I'll be very happy! :-) thanks!

marmin

  • Jr. Member
  • **
  • Posts: 86
    • http://www.naton.org
RE: showing a form
« Reply #1 on: August 15, 2005, 07:34:28 pm »
please, elaborate.

opening form? you can not make a new form in your project?
Marmin^.Style
Location: Pointer Land!

Anonymous

  • Guest
RE: showing a form
« Reply #2 on: August 15, 2005, 07:43:26 pm »
hum sorry.. I have form1 and form2, I wanna call the form2 from the form1 by clicking on a button!

Anonymous

  • Guest
RE: showing a form
« Reply #3 on: August 15, 2005, 07:58:23 pm »
hi i found this on the internet. you put the unit name of the sencond form at the uses word.. and on the button you put this
Application.CreateForm(Tform,form);
   form.Showmodal;
I really need to put Application.Crea.....???

RudieD

  • Full Member
  • ***
  • Posts: 234
RE: showing a form
« Reply #4 on: August 15, 2005, 09:35:27 pm »
You can just use
...  
  with TForm2.Create(Self) do  
  begin
     ...
     Name := 'SomeName';
     Show;
  end;
...

Hope this helps !
The FRED Trainer. (Training FRED with Lazarus/FPC)

RudieD

  • Full Member
  • ***
  • Posts: 234
RE: showing a form
« Reply #5 on: August 15, 2005, 09:40:05 pm »
Hi , (Me again)

The previous Sample will still enable you to switch between the forms. If you want to wait for the second form then you can use something like this

...
with TForm2.Create(Self) do
try
  ...
  Name := 'SomeName';
  ShowModal;
  if ModalResult = mrOk then
  begin
    ...
  end;
finally
  Free;
end;
...

Hope this also helps !
The FRED Trainer. (Training FRED with Lazarus/FPC)

 

TinyPortal © 2005-2018