Recent

Author Topic: Rename Form  (Read 5263 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Rename Form
« on: December 05, 2016, 01:42:49 pm »
Hi!
I have created a second form with Form1 being the main one.
I was wondering if it is possible to rename Form2.
I made some changes in the class and lpr file but I still get: main.pas(1312,3) Error: Identifier not found "FormChecks" .

Code: Pascal  [Select][+][-]
  1. PROCEDURE TForm1.Button1Click(Sender : TObject);
  2. BEGIN
  3.   FormChecks.Show;
  4. END;
  5.  

Code: Pascal  [Select][+][-]
  1. BEGIN
  2.     RequireDerivedFormResource := TRUE;
  3.     Application.Initialize;
  4.     Application.CreateForm(TForm1, Form1);
  5.     Application.CreateForm(TFormChecks, FormChecks);
  6.     Application.Run;
  7. END.
  8.  

Code: Pascal  [Select][+][-]
  1. UNIT checks_theform;
  2. ...
  3. TYPE
  4. TFormChecks = CLASS(TForm)
  5.   BGRAImageList1   : TBGRAImageList;
  6.   Memo1   : TMemo;
  7.   PROCEDURE FormCreate(Sender : TObject);
  8. private  
  9.  

Thank you.
Lazarus 2.0.2 64b on Debian LXDE 10

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
Re: Rename Form
« Reply #1 on: December 05, 2016, 03:13:21 pm »
Have you included a use statement for formChecks in Form1?
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Rename Form
« Reply #2 on: December 05, 2016, 03:25:29 pm »
Thank you.
It was included but I still see in Project Forms the renamed form with the old name.
Shouldn't the view form option and Object Inspector present the form with the new name?
Please see screen capture.
Lazarus 2.0.2 64b on Debian LXDE 10

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Rename Form
« Reply #3 on: December 05, 2016, 03:42:48 pm »
Also I get the attached error at run time.
Using Lazarus 1.6.2 32b on Windows 7 64b.
« Last Edit: December 05, 2016, 03:52:29 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Rename Form
« Reply #4 on: December 05, 2016, 05:09:57 pm »
A form name *must* (well, should) be changed from the object inspector, not in your code.  The lfm doesn't update, unless the whole project is loaded and parsed once..
« Last Edit: December 05, 2016, 05:12:03 pm by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018