Dunric
2003-12-09 15:35:32 UTC
Let:
Global variable is defined in main program scope (f.E.: Delphi project
file).
Variable of record type is defined in the same scope. Name of one of
the record elements is equal to a name of this global variable.
Question:
How to correctly reference global variable within with..do statement
when its name conflicts with name of element defined in a record ?
Maybe it's trivial, but I could't find any solution :-(
sample code of Test.dpr:
----------------------------
program test;
{$APPTYPE GUI}
uses Windows, Messages;
type
MyRecord = record
myInst: LongWord;
someOther: Boolean;
end;
var
myInst: LongWord;
myRec: MyRecord;
...
begin
...
myInst := HInstance;
with myRec do
begin
myInst := {global} myInst; // !!!!!!!!!!!!!!!!!!!!!
someOther := False;
end;
...
end.
When variable is defined in a delphi unit there is no problem(point
operator) but in a project file ?
Global variable is defined in main program scope (f.E.: Delphi project
file).
Variable of record type is defined in the same scope. Name of one of
the record elements is equal to a name of this global variable.
Question:
How to correctly reference global variable within with..do statement
when its name conflicts with name of element defined in a record ?
Maybe it's trivial, but I could't find any solution :-(
sample code of Test.dpr:
----------------------------
program test;
{$APPTYPE GUI}
uses Windows, Messages;
type
MyRecord = record
myInst: LongWord;
someOther: Boolean;
end;
var
myInst: LongWord;
myRec: MyRecord;
...
begin
...
myInst := HInstance;
with myRec do
begin
myInst := {global} myInst; // !!!!!!!!!!!!!!!!!!!!!
someOther := False;
end;
...
end.
When variable is defined in a delphi unit there is no problem(point
operator) but in a project file ?