2009. június 18., csütörtök

Move components from Delphi 5 to Delphi 6


Problem/Question/Abstract:

Have you tried to compile your components, or 3rd party components you have in Delphi 5 into Delphi 6?
99% of them will not compile. However do not despare. It is only because of a few changes Borland has implemented on their latest product. This article covers the major changes.

Answer:

First of all, you will discover that the unit dsgnintf.pas is missing. Borland changed the name to Designintf.pas, moved the property editor code to a new unit, called DesignEditors.pas, put the constants used inside DesignConsts.pas and the menus inside DesignMenus.pas

Also the variants have moved from system.pas to their own unit called Variants.pas

The IFormDesigner interface isn't there anymore. You should use the IDesigner and typecast your variables. (this is a change probably made to accomodate the CLX and I was unable to find any documentation on it from either Borland or Delphi 6 Online help system. I only found that every IFormDesigner has been repaced with IDesigner)

The IDesignerSelections interface has also changed. The most helpfull change is the addition of a Get function that returns a TPersistent when giving the index of the member.

On previous versions if you wanted the TPersistent of an object you wrote:

var
  p: TPersistant;
  ...
    P := Selections[i] as TPersistant;

Now you only write:

var
  p: TPersistant;
  ...
    P := Selections.get[i];

That's about it. I have used these simple instructions to recompile all of  my third party tools, and all of my custom components.

P.S. Just remember... you have to have the source code to do this!!! :-)

Nincsenek megjegyzések:

Megjegyzés küldése