Question

As is routine when trying to move components to newer versions of Delphi, Borland breaks compatibility by renaming, hiding, or removing various classes used by design time code.

Today's case involves a code library that we purchased years ago, which we have the source code for. Attempting to install the "design time" package in Delphi 7 IDE fails when the unit ExptIntf is not found:

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Contoso3Const, StdCtrls, ExtCtrls, ContosoRpt, DBTables, ContosoDataWz, ContosoExtra,
  ExptIntf,
  ToolIntf, ContosoWizard, ActiveX;

No problem. We'll comment out the reference. But then another unit, ToolIntf is not found:

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Contoso3Const, StdCtrls, ExtCtrls, ContosoRpt, DBTables, ContosoDataWz, ContosoExtra,
  //ExptIntf,
  ToolIntf, 
  ContosoWizard, ActiveX;

No problem. We'll comment out the reference. This is when the real fun begins.

The class TIExpert isn't found:

{$INCLUDE compilers.inc}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Contoso3Const, StdCtrls, ExtCtrls, ContosoRpt, DBTables, ContosoDataWz, ContosoExtra,
  {$IFDEF DELPHI_6_UP}
  //They've been removed in D6
  //ExptIntf, ToolIntf,
  {$ELSE}
  ExptIntf, ToolIntf,
  {$ENDIF}
  ContosoWizard, ActiveX;

type
  TContosoIDEWizard = class(TIExpert)
  public
     ...

A quick Googling says that the code will never work in Delphi 6:

That is the old style OTA that was depreciated in D4 and gone in D6. You will have to re write using the OTA interface style introduced in D4.

The poster doesn't mention what the new OTA interface style introduced in D4 is.

Given that i'm going to have to re-write two classes in 3rd party code:

  TContosoIDEWizard = class(TIExpert)
  public
    SourceBuffer: PChar;
    function GetName: string; override;
    function GetComment: string; override;
    function GetGlyph: HICON; override;
    function GetStyle: TExpertStyle; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetAuthor: string; override;
    function GetPage: string; override;
    procedure Execute; override;
    function CreateForm(Report : TCustomContosoRep; const FormIdent : string; VarList : TStrings) : TMemoryStream;
    function CreateSource(const UnitIdent, FormIdent: string; VarList : TStrings): TMemoryStream;
  end;

  TNewContosoReport = class(TIExpert)
    function GetName: string; override;
    function GetComment: string; override;
    function GetGlyph: HICON; override;
    function GetStyle: TExpertStyle; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetAuthor: string; override;
    function GetPage: string; override;
    function GetMenuText: string; override;
    procedure Execute; override;
  end;

what do re-write them into? i assume it is as simple as using a different base class name, that contains all the same methods, and no actual code re-writes (of code i didn't write) will be required.

Note: The identity of the 3rd party library has been poorly obfuscated for your safety

Note:

  • Tagged delphi-5; as that's the IDE i'm moving from
  • Tagged delphi-7; as that's the IDE i'm moving to
  • Tagged delphi-6; as that's the IDE that broke functioning code
  • Tagged delphi as that's the development tool we're talking about
Was it helpful?

Solution

TIExpert was replaced with a new hierarchy of interfaces derived from IOTAWizard. There are plenty of OpenTools API tutorials online, such as this one, as well as official documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top