Recent

Author Topic: [SOLVED] Creating two same frames within one form  (Read 1029 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1273
[SOLVED] Creating two same frames within one form
« on: October 01, 2019, 07:24:53 am »
Hi,

Can't I create same frame more than once within a form?
In the following example, I met 'Form1 already exists' exception at the second construction of TForm1.

Code: Pascal  [Select][+][-]
  1. type
  2.     TForm1 = class(TFRame);
  3.  
  4. ////
  5.     TForm2 = class(TForm)
  6.     public
  7.          tf1, tf2: TForm1;
  8.     end;
  9.  
  10.  
  11. procedure TForm2.Button5Click(Sender: TObject);
  12. begin
  13.   tf1 := TForm1.Create(Self);
  14.   tf2 := TForm1.Create(Self);  // Here error occurs.
  15. end;
  16.  
« Last Edit: October 02, 2019, 04:53:01 am by egsuh »

tetrastes

  • Sr. Member
  • ****
  • Posts: 473
Re: Creating two same frames within one form
« Reply #1 on: October 01, 2019, 02:34:31 pm »
Code: Pascal  [Select][+][-]
  1.    tf1 := TForm1.Create(Self);
  2.    tf1.Name := '';
  3.    tf2 := TForm1.Create(Self);
  4.  
« Last Edit: October 01, 2019, 02:40:01 pm by tetrastes »

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Creating two same frames within one form
« Reply #2 on: October 02, 2019, 04:52:38 am »
Haha.... just simple.
But it's strange. tf1 should be the name in components.

 

TinyPortal © 2005-2018