Recent

Author Topic: [New Programmer] Some questions  (Read 17769 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: [New Programmer] Some questions
« Reply #15 on: March 24, 2011, 02:45:52 am »
sl.Free frees the newly created sl.

fiqs

  • New member
  • *
  • Posts: 8
Re: [New Programmer] Some questions
« Reply #16 on: March 24, 2011, 05:49:10 pm »
The TfrmAdic is defined in the Unit1(TfrmAdic). Yes, in another unit. The problem is, when I try to add the Unit1 in the uses statment, I get the following error:
Code: [Select]
unit2.pas(9,18) Fatal: Circular unit reference between Unit2 and Unit1
And when I remove the frmAdic var declaration(from the Unit2, right?) I get the following error:
Code: [Select]
unit2.pas(57,9) Error: Identifier not found "frmAdic"
This without the Unit1 in the uses statment, because with the Unit1, I get the first error.
If you want, I can post all the Units here.

And about the use of Halt, you mean Application.Halt, just Halt or what?

The "circular reference" is obviously a consequence of you using unit2 in unit1, so this happens when you also use unit1 in unit2. However, you must use unit1 in unit2 or you cannot call frmAdic. You can avoid the circular dependency problem if you use those units from implementation instead of interface section. That works only if you don't have declarations in the used unit that the other unit needs, but I guess you don't. So, add "uses unit1;" under the implementation keyword and see if it works ok.

BTW I think it's wise to always use own units within implementation whenever you don't need their declarations. That way you avoid circular reference problems in advance.

And I mean just "Halt", not "Application.Halt". It' s a procedure specifically meant for this use, to be called like that. You may also use Halt(number) if you want the program to return a value IIRC...

Finally, it worked! Thank you.

Another question, what do you think about this radiobutton method using Form.Show? Do you know any better methods?

And again, thanks!

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: [New Programmer] Some questions
« Reply #17 on: March 24, 2011, 06:01:08 pm »
Quote
Another question, what do you think about this radiobutton method using Form.Show? Do you know any better methods?

I didn't quite understand how you did it. You may need to BringToFront the form that you showed up last.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: [New Programmer] Some questions
« Reply #18 on: March 24, 2011, 08:01:26 pm »
I think that way you used to hide and show forms should be right, if it works ok for you...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

 

TinyPortal © 2005-2018