Mark Derricutt asked:
> Is it possible to do something like:
>
> type
> TMyObject = class
> private
> function GetBool: Boolean;
> procedure SetBool(Value: Boolean);
> public
> property Bool1: Boolean read GetBool write SetBool;
> property Bool2: Boolean read GetBool write SetBool;
> end;
Yes, but the way to achieve that in Delphi is as follows:
type
TMyObject = class
private
BoolArray: array[1 .. 2] Of Boolean;
function GetBool(Index: Integer): Boolean;
procedure SetBool(Index: Integer; Value: Boolean);
public
property Bool1: Boolean index 1 read GetBool write SetBool;
property Bool2: Boolean index 2 read GetBool write SetBool;
end;
function TMyObject.GetBool(Index: Integer): Boolean;
begin
// Get the boolean from somewhere using Index
end;
procedure TMyObject.SetBool(Index: Integer; Value: Boolean);
begin
// Store the boolean from somewhere using Index
end;
Have a look in the online help in the area dealing with funky property
declarations.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"