--On Tuesday, July 06, 1999, 8:27 AM +1200 Jeremy Coulter <[EMAIL PROTECTED]>
wrote:

> By that I mean HOW it works, i.e. how you can set data with it, i.e.
> fieldbyname('name').asstring:='joe'; AND you can get data from it, i.e.
> fieldbyname('Name').asstring.
> So how do you create a property with this type of functionality ?

private
  function GetProp(Index: string): String;
  procedure SetProp(Index: string; Value: string): String;
public
  property Prop[Index: string]: String read GetProp write SetProp;
end;

The var Index can be anything you want, as long as its declared the same
throughout.

Then in your Get/Set code handle the lookup anyway you want, and just refer
to the property with Object.Prop['Something'];

-- 
Mark Derricutt

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to