Hello Tony!
Thursday July 03 1997, Tony Dunn writes to All:
TD> [LabelFont]
TD> LabelFontColor=clAqua
TD> ...then a line like:
TD> Label1.font.color := VeejoIni.ReadInteger('LabelFont',
TD> 'LabelFontColor', clBlack);
TD> in my code for FormActivate does not read it, but uses the default, in
TD> the above case, clBlack. If the value in the INI file for
TD> LabelFontColor is actually numerical like 8388608, then it does read
TD> it just fine and changes the label.font.color to whatever the number
TD> represents. Why???
You can't use constant names directly for external data storage, just like
you can't enter clAqua in a TEdit and expect it to become whatever value
clAqua has. I'd recommend just using numbers.
If you _really_ need the ability to use constant names, you could create an
array containing both a string (clAqua, for instance) and its corresponding
number, such as:
type TConstant = record
name : string;
value : longint;
end;
var constant : array[1...xxxx] of TConstant =
...
and then constructing a lookup function - you would then need to construct a
special read method that involved the lookup function, or converting the
string to a number, if the user preferred to type a number in the INI file.
The numbers are just ordinary Windows RGB values, so most users who would
edit the INI file manually would prefer the RGB value, I think (try looking
at your GRAPHICS.INT file and see the definitions of clXXXXX for yourself!).
And DELPHI would rather use the numbers, so why not?
Lars
--- GoldED/386 2.50 UNREG
---------------
* Origin: Yet another T.P.I. Point (2:238/64.46)
|