Hi Rob --
Thanks for taking the time to write such a lengthy and educational response; I
really appreciate it. The funny thing is, I'm still unsure about what to pass
when trying to facilitate communication between classes--even if I'm OK with
the difference between passing by value and by reference, that TForm1 is
descended from TForm, that the var declaration (below) creates only memory
space pointing to the address of an instance of type TForm1, etc.
So, if it's OK with you, let me give you a silly situation, and ask you about
what the code would look like. I'll use default values throughout, and start
with a form, a memo, and a button. Unit1 would include this code:
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Create a new class, TIni, to make the following two things happen. When Form1
closes, the form's width and the memo's lines should be saved to an ini file.
(If it's easier to save Memo1.Text than Memo1.Lines, that's OK.) I assume the
procedure to write configuration info to disk would include ...
procedure TIni.WriteConfig (???);
var
aIniFile: TIniFile;
begin
//writes user info to config.ini
AIniFile := TIniFile.Create(ExtractFilePath(Application.EXEName) +
'config.ini');
try
with AIniFile do
begin
WriteInteger('Config', 'Width', Form1.width);
//something like a WriteString method to save Memo1's Text, or a series
of WriteStrings to save each of Memo1's Lines
end;
finally
aIniFile.Free;
end;
end;
If there's other types of variables, references, etc. that are commonly passed
between objects, you might save a later posting from me by mentioning them now
:-)
Thank you again, and reply only if you find the time. But know that your
replies and those of others make a difference to me. If there's a basic
reference you think I ought to look at, feel free to mention it. I'd love to
take a class, but Delphi-based instruction seems to be unavailable. -- Al
_________________________________________________________________
Type your favorite song. Get a customized station. Try MSN Radio powered by
Pandora.
http://radio.msn.com
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi