Board index » delphi » Bug in Delphi 1.0 and Delphi 2.0 IDE

Bug in Delphi 1.0 and Delphi 2.0 IDE

Hi, Ive just come onto a bug that appears in both the 1.0 and 2.0 IDE's.

The IDE incorrectly reports that the uses clause is invalid or missing
when there are conditional compilation directives
specified in the interface import section.

EG.

Uses
  Forms,.......,
{$IFDEF Win32}
  Registry;  //Use New registry
{$ELSE}
  INIFiles; //Use old Ini Files
{$ENDIF}

The Compiler compiles it fine but the IDE doesn't like it.

Regards
Peter

 

Re:Bug in Delphi 1.0 and Delphi 2.0 IDE


On Wed, 20 Mar 1996 09:22:57 +0200, Peter van Lonkhuyzen

Quote
<pet...@global.co.za> wrote:
>Hi, Ive just come onto a bug that appears in both the 1.0 and 2.0 IDE's.

>The IDE incorrectly reports that the uses clause is invalid or missing
>when there are conditional compilation directives
>specified in the interface import section.

>EG.

>Uses
>  Forms,.......,
>{$IFDEF Win32}
>  Registry;  //Use New registry
>{$ELSE}
>  INIFiles; //Use old Ini Files
>{$ENDIF}

>The Compiler compiles it fine but the IDE doesn't like it.

The IDE parses the source file at design-time. This lets the IDE add
unit references for the comonents that are dropped on the form. Using
compilation directives is problematic since the IDE cannot tell
whether WIN32 will be defined when the unit is compiled.

In your particular case, I recommend using the TRegIniFile class,
which works like TIniFile, but uses the registry. It is a trivial
matter to declare TRegIniFile = TIniFile in Delphi 1.0, so you can use
TRegIniFile and have complete portability at the source level.
--
Ray Lischner                              li...@tempest-sw.com
Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

Re:Bug in Delphi 1.0 and Delphi 2.0 IDE


Quote
Ray Lischner wrote:

> On Wed, 20 Mar 1996 09:22:57 +0200, Peter van Lonkhuyzen
> <pet...@global.co.za> wrote:

> >Hi, Ive just come onto a bug that appears in both the 1.0 and 2.0 IDE's.

> >The IDE incorrectly reports that the uses clause is invalid or missing
> >when there are conditional compilation directives
> >specified in the interface import section.

> >EG.

> >Uses
> >  Forms,.......,
> >{$IFDEF Win32}
> >  Registry;  //Use New registry
> >{$ELSE}
> >  INIFiles; //Use old Ini Files
> >{$ENDIF}

> >The Compiler compiles it fine but the IDE doesn't like it.

> The IDE parses the source file at design-time. This lets the IDE add
> unit references for the comonents that are dropped on the form. Using
> compilation directives is problematic since the IDE cannot tell
> whether WIN32 will be defined when the unit is compiled.

> In your particular case, I recommend using the TRegIniFile class,
> which works like TIniFile, but uses the registry. It is a trivial
> matter to declare TRegIniFile = TIniFile in Delphi 1.0, so you can use
> TRegIniFile and have complete portability at the source level.
> --
> Ray Lischner                              li...@tempest-sw.com
> Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

I am actually using the TRegIniFile Class but because it was required in
the interface section I had to use conditional compilation.

My work around was to define INI as TObject in the Interface section
and in the implementation section I could use the conditinal flags to
use the correct DCU. and access INI using typecasting.

Regards
Peter

Other Threads