Book a Demo

Author Topic: Field getting added to Delphi Class   m_TRowL  (Read 3281 times)

Bill Egge

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Field getting added to Delphi Class   m_TRowL
« on: April 14, 2005, 06:22:51 pm »
I have a class named TTableGen which has a reference to a TRowLooper.  Each time I generate the code, a new field gets added to the TTableGen class in the public area in the form of

m_TRowLooper: TRowLooper;


Why is it doing that?  I already have a field named FRowLooper but for some reason EA wants to create this new field.


This is what the class is suppose to look like:
Code: [Select]

 TTableGen = class
 private
   FColumns: TColumnArray;
   FRowLooper: TRowLooper;
   procedure LoadColumns(Main: _Recordset);
   procedure LoadRowLooper(Main: _Recordset);
 public
   function GetText: String;
   procedure LoadFromRecordset(R: _Recordset);
   constructor Create; overload;
   destructor Destroy; override;
   property Columns: TColumnArray read FColumns write FColumns;
   property RowLooper: TRowLooper read FRowLooper write FRowLooper;
 end;


I re-import the source and turn right around and generate the source and I get this:

Code: [Select]

 TTableGen = class
 private
   FColumns: TColumnArray;
   FRowLooper: TRowLooper;
   procedure LoadColumns(Main: _Recordset);
   procedure LoadRowLooper(Main: _Recordset);
 public
   m_TColumn: TColumn;
   m_TRowLooper: TRowLooper;
   function GetText: String;
   procedure LoadFromRecordset(R: _Recordset);
   constructor Create; overload;
   destructor Destroy; override;
   property Columns: TColumnArray read FColumns write FColumns;
   property RowLooper: TRowLooper read FRowLooper write FRowLooper;
 end;


The only explanation I can come up with is that I added a composite relationship between these classes in the diagram editor.

« Last Edit: April 14, 2005, 06:23:35 pm by begge »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Field getting added to Delphi Class   m_TRowL
« Reply #1 on: April 14, 2005, 08:19:49 pm »
EA is autogenerating a role for your composite relationship.  To stop it go to the Generation page of the options dialog (Tools | Options) and uncheck "Auto generate role names when creating code".

Alternatively you could go to the Attributes/Operations dialog and edit the default name generated.  I don't think you can get FRowLooper from TRowLooper by doing that though.

Simon

Bill Egge

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Re: Field getting added to Delphi Class   m_TRowL
« Reply #2 on: April 15, 2005, 05:19:06 am »
Thank you,  I decided to try your alternative and it worked.  But I had to edit it from the properties of the composite line in the diagram by setting the role.

Thank you.

« Last Edit: April 15, 2005, 05:20:12 am by begge »