[fpc-devel] Property overloading vs. property array enumerators
    Ondrej Pokorny 
    lazarus at kluug.net
       
    Thu Jan 28 16:36:30 CET 2016
    
    
  
On 28.01.2016 16:23, Anthony Walter wrote:
> Here is a preferable solution:
>
>     property Controls: IControlEnumerator read GetItems;
You are already the third person suggesting it :)
Yes, it is possible. You can do it with your code. I still don't know if 
there is a will to modify:
   TWinControl = class(TControl)
     // ...
     property Controls[Index: Integer]: TControl read GetControl;
to
   TWinControl = class(TControl)
     // ...
     property Controls: IWinControlControls read GetControls;
Something like
   TWinControl = class(TControl)
     // ...
     property Controls[Index: Integer]: TControl read GetControl 
enumerator GetControlEnumerator;
or
   TWinControl = class(TControl)
     // ...
     property Controls[Index: Integer]: TControl read GetControl;
     property Controls: TControlEnumerator read GetControlEnumerator;
seems better suited from my POV.
(The same for TStrings.Objects etc.)
Ondrej
    
    
More information about the fpc-devel
mailing list