I want to know if it is possible to get the name of a variable as text/string 
(I know this might
be impossible).

For example I need a function that will accept as input a variable and will 
return a string that
is the name of that variable. If my variable is FontSize the function will 
return 'FontSize'.


More examples:
If my function will be this:
       function ConvertToString(AVariable: integer): string;
then running this program:

---------------------------
var FontSize: integer;
    s: string;
begin
 s:= ConvertToString(FontSize);
end;
---------------------------

s will be 'FontSize'.


I want to use this to store my program's forms state on the HDD in a INI file 
then restore it when
the program starts again.
I already do this by using something like this:

MyIniFile:= TCIniFile.Create(GetApplicationDir+'settings.ini');
With MyIniFile DO 
 With MainForm DO
   begin
    Left        := ReadInteger('WindowState', 'left', 50);
    top         := ReadInteger('WindowState', 'top' , 50);
    Width       := ReadInteger('WindowState', 'width' , 750);
    Height      := ReadInteger('WindowState', 'height', 550);
    checkboxes, etc...
   end; 

but I would like to simplify it to something like 

    SaveToIni(Left);
    SaveToIni(Top);
    etc...



-----------------------------------------------
-----------------------------------------------
-----------------------------------------------


I realized that in a big program with lots of windows and buttons I can spend 
lots of time coding
the store/restore functions.
It is also very error prone.

There is a VERY good VCL that can store automatically this information for me?
I tried several VCLs but all had some problems/limitations.





If I choose Christianity then the Islamic will say I'm a pagan.
If I choose Islamic then the Buddhism will say I'm a pagan.
If I chose Buddhism then the Jewish will say I'm pagan.
If I choose no God then everybody will say I'm pagan.
Please, can I be free? Can you NOT tell me how I should live MY life?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to