Hi There!
   
  I m trying to migrate from delphi3 to delphi5.
  In That i would like to know is there any difference for dynamic arrays that 
were used in Delphi3 and Delphi5?
  I m just trying to execute delphi3 code in delphi5 enviroment. Is there any 
change needed to make it run properly?
   
  I m giving code snippet, Please help me in moving ahead:
   
  In LibInfo.pas file:
   
  TSysElClass = class of TSysEl;
  
TDirectory = class
  private
    FPDataTypes: TList;
   FSysElClasses: TList;     
  public 
  constructor Create(PDataTypes : array of TPDataType;
                       SysElClasses : array of TSysElClass;
                       ReqdDirs     : array of ShortString;
                       UsedPubUnits : array of ShortString;
                       UsedPriUnits : array of ShortString);    virtual;

      destructor Destroy;                                                
override; 
   
    property PDataType [DTID:Integer]: TPDataType  read GetPDataType;  default;
   
   property SysElClass[SEID: Integer]: TSysElClass read GetSysElClass;
  end;
   
  Implementation
   
  Some global functions declarations ....
   
  constructor TDirectory.Create(PDataTypes   : array of TPDataType;
                              SysElClasses : array of TSysElClass;
                              ReqdDirs     : array of ShortString;
                              UsedPubUnits : array of ShortString;
                              UsedPriUnits : array of ShortString);
var
  i: Integer;
  begin
    inherited Create;
   FPDataTypes:= TList.Create;
  FEditorClasses:= TList.Create;
  FDataTypesModified := False;
  for i:= 0 to High(PDataTypes) do
    if assigned(PDataTypes[i]) then begin
      FPDataTypes.Add(PDataTypes[i]);
      if Assigned(PDataTypes[i].EditorClass)then
        FEditorClasses.Add(PDataTypes[i].EditorClass)
      ;//end if
    end;//if
  /// SysElClasses
  FSysElClasses:= TList.Create;
  for i:= 0 to High(SysElClasses) do
    if Assigned(SysElClasses[i]) then begin
      FSysElClasses.Add(SysElClasses[i]);
      if SysElClasses[i].ClassName <> 'TSysEl' then
        RegisterClass(SysElClasses[i])                // Register SysEl Classes
      ;//end if
    end//if
  ;//end for every SysEl Class
  // SysEls to be turned into SysElClasses

  and such more loops for ReqdDirs,UsedPubUnits  and UsedPriUnits 
   
  end;
   
  TSIDELib = class(TList)
   
  private....
   
  procedure SetDir......
  function GetDir......
  public 
  Constructor create(..........
  destructor destroy..............
   
  end;
   
  Now in SeTsysel.pas file:
   
  TPDataType = ^TDataType;
   
  TDataType = record 
//----------------------------------------------------------
  Name   : ShortString;      //String
  Size   : Integer;
  KindOf : ShortString;   // used to search library for PDataType
  EditorClass: TEditorClass;
  ViewerClass: TViewerClass;
  //Modified: Boolean;
  case Typ: TDataTyp of
    //dtSimple:(
    dtEnum:  (
      NumEnums    : Integer;
      EnumName    : TEnumName;
      EnumNameL   : TStringList  );
   
   and such for dtRecord,dtObject,dtArray,dtDynArray diff. case Typ.
   
  end;
   
  Now in dtSideLib.pas file. This file resides in sub-folder and is used in 
package SideLib.Pkg.
   
  unit .....
  interface.....
  uses....
   function GetDPLDir: TDirectory; // TDirectory is class in LibInfo.pas 
  procedure SetSIDELib(aSIDELib: TSIDELib); // TSideLib is again class in 
LibInfo.pas
  exports GetDPLDir, SetSIDELib; // provides access to its Directory obj

  const
dtTDynArray: TDataType= (Name:'TDynArray'; Size:SizeOf(Single); 
KindOf:'SystemDefined';
                      EditorClass:nil; ViewerClass:nil; Typ:dtDynArray);
  const
dtByte: TDataType= (Name:'Byte'; Size:SizeOf(Byte); KindOf:'SystemDefined';
                      EditorClass:nil; ViewerClass:nil; Typ:dtSimple);

  const
dtUnknown: TDataType= (Name:'Unknown'; Size:SizeOf(Unknown); 
KindOf:'SystemDefined';
                      EditorClass:nil; ViewerClass:nil; Typ:dtSimple);

  and similar type of few more DataTypes.....
   
  implementation
  //Initialization & Finalization Code 
//////////////////////////////////////////
var
    Directory: TDirectory;  // created when loaded, freed when unloaded
  function GetDPLDir: TDirectory;             // every directory must have one
begin  Result:= Directory;                  // ...used by TSIDELib
end;
  procedure SetSIDELib(aSIDELib: TSIDELib);   // every directory must have one
begin  SIDELib := aSIDELib;                 // ...used by TSIDELib
end;
  initialization 
////////////////////////////////////////////////////////////////
  Directory:= TDirectory.Create(
  //DataTypes Defined
    [EMAIL PROTECTED],
     @dtUnknown,
     @dtSingle,
     @dtInteger,
     @dtString,
     @dtDouble,
     @dtDateTime,
     @dtBoolean,
     @dtTDynArray,
     @dtStringList,
     @dtList],
  //Contained SysElClasses
    [TSysEl{,
     TLandingGearDesign}],
  //Required Directory Packages
    [''],
  //Used Public Units
    [''],
  //Used Private Units
    ['']
  );
  finalization 
//////////////////////////////////////////////////////////////////
  Directory.Free;
  end.
   
  Here all  'DataTypes'  written with @.... get displayed properly on screen on 
running, but 'SysElClasses'  values not displayed.
  I don't know why ???
  According to my program requirement, it should display followed by DataTypes.
  What should i do to display this components?
   
  There is no pointer defined for SysElClasses as for DataType like 
  TPDataType = ^TDataType.
  Is this the cause of problem.
  I m not familier with delphi + dynamic arrays too.
  Any guidence regarding How to solve this would greatly be appreciated.
  Thanks.....
   
  Looking for your kind help always.
  With regards,
  -Bijal... 
   
   
   

                                
---------------------------------
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

[Non-text portions of this message have been removed]



-------------------------------------------------------
Home: http://groups.yahoo.com/group/delphi-programming/
Remove: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-programming/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to