Watch, Follow, &
Connect with Us
Public Report
Report From:    [ Add a report in this area ]  
Report #:  7291   Status: Closed
Class Completion for property setters broken
Project:   Build #:  7.1.1446.610
Version:    8.0 Submitted By:   Lee Grissom
Report Type:  Basic functionality failure Date Reported:  2/13/2004 10:24:34 AM
Severity:    Serious / Highly visible problem Last Updated: 6/7/2005 1:51:20 AM
Platform:    All versions Internal Tracking #:  
Resolution: Fixed (Resolution Comments) Resolved in Build: : 9.0.1761.24408
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
When you attempt to perform Class completion for a property setter, the IDE puts the Setter procedure below the property, which is bad b/c the code won't compile.  The setter must be declared above the property.  In addition, I believe it should go in the private section by default.
Steps to Reproduce:
1. File -> New -> Unit
2. Copy and paste this code into the new unit.
3. Press Ctrl+Shift+C to perform a class completion operation.

unit Unit1;
interface
type
  MyClass = class
  private
    FOne: Integer;
  public
    property One: Integer read FOne write SetOne;
  end;
implementation

end.


(*
Below is what you end up with...
Note, that if you have a "getter" on one of your properties, then the Editor will correctly put your routines above the property, but it puts it into a public section, which I think should be private.
*)

unit Unit1;
interface
type
  MyClass = class
  private
    FOne: Integer;
  public
    property One: Integer read FOne write SetOne;
    // BUG.  "SetOne" should be ABOVE the property the uses it.
    // I believe it should default to the private section, but that's open for debate.
    procedure SetOne(const Value: Integer);
  end;
implementation

{ MyClass }

procedure MyClass.SetOne(const Value: Integer);
begin
  FOne := Value;
end;

end.
Workarounds
None
Attachment
None
Comments

Lee Grissom at 2/18/2005 9:56:59 AM -
This report is kind of related to Report# 10901.  I don't have access to Delphi 2005 right now, so can someone verify that the setters are correctly placed *before* the property so that it will compile?

Server Response from: ETNACODE01