Hi folks --

I cannot tell you how frustrated I am that I apparently *still* don't fully 
understand communication between classes/forms! I won't share all my code with 
you, but let me tell you what I was trying to do & hopefully one of you can 
explain to me what's going on so I can understand, once and for all. The basic 
problem is to create a class which will take care of saving values at shutdown 
and loading them at startup, i.e., a config file. [I understand iniFiles and 
regIniFiles; that is not the issue.] 

For the sake of argument, suppose I wanted to store values related to the main 
form, a component on the form, and a class property. I think that takes care of 
most possibilities :-) 

I am apparently confused and clueless regarding issues like what parameters I 
need to have in the IniClass's method signatures, whether they are sent by 
reference or by value (even though I thought I understood that, thanks to you 
folks), and even where it's best to instantiate IniClass instances (I don't 
fully understand why I can save and retrieve Form1 values when I instantiate 
the IniClass in the initialization section of Form1...How can you set Form1's 
Top, Height, etc. before Form1 has been created?).

At first I tried initiating an instance of the IniClass in the Form1 OnCreate 
event, passing a reference to Form1 itself to the IniClass--thinking that would 
allow me to pass not only properties from Form1 but also therefore Form1's 
components, or at least Form1 public properties that I created to hold class 
level variables. Form1's properties are properly set, but Form1 component 
properties and variables aren't passed:

type
TIniClass=class(TObject)
private
public
  procedure readConfig (var Form1:TForm);
  procedure write Config (var Form1:TForm);
end;

procedure Form1.OnCreate ...
ini:=TIni.Create;
ini.readConfig(Form1);
ini.Free;

I sort of understand why component properties would be inaccessible, but I 
don't understand why the class properties wouldn't be accessible.

Thank you, in advance, for the insight that will help lower my blood pressure 
:-)

Al C.
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to