Recent

Author Topic: Very simple question  (Read 4327 times)

wb

  • Guest
Very simple question
« on: May 11, 2004, 08:00:26 pm »
There are 2 forms, I want to load form2 by button on form1, I tried to use Form2.show;, but it gives me "Error: Identifier not found "Form2" :(
This worked in Delphi..

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Very simple question
« Reply #1 on: May 11, 2004, 11:05:05 pm »
Compare the uses clauses of your Delphi app and your lazarus app.

Uses unit2 must be in unit1. (or something like that).

Anonymous

  • Guest
Very simple question
« Reply #2 on: May 15, 2004, 02:29:44 pm »
ok thanks i'll try!
sry that myanswer is late, i dont have much time for inet at the moment..

bzuK

  • Newbie
  • Posts: 1
There are two forms...
« Reply #3 on: September 20, 2007, 08:54:56 pm »
There are 2 forms, I can use the "uses" clause so that the first form can access to the other, but in it is not possible to make this in both directions.
Quote
(Fatal: Circular unit reference between Unit 1and Unit2

Is there a solution?

There are 2 forms, Unit1 says
Code: [Select]
Form2.Show; Form1.Hide;
When Form2 is closed by user, Application doesn't end, Form1 is still the "MainForm" and keeps running, but hidden.
I tried
Code: [Select]
Form2.Show; Form1.Close; but then the application ends immediately?!

Thanks a lot for your advice
Martin

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: There are two forms...
« Reply #4 on: September 20, 2007, 09:12:37 pm »
Quote from: "bzuK"

Is there a solution?


Yes, put your uses clause on the implementation part of the unit.

Code: [Select]

unit unit1;
(...)
implementation
uses unit2;
(...)


Code: [Select]

unit unit2;
(...)
implementation
uses unit1;
(...)


Application ends every time you close main form.

 

TinyPortal © 2005-2018