. , Published Dfin-.
) Default , . , 2.2, .
:
. Nil, .
- , , .
Default , . , *.Dfm . , Default, , .
, Published, no .
- Default - , . , [] . , - . - .
Type
TAnyClass=Class // ...
//
Property Strings[Index: Integer]: String Read GetStr Write SetStr; Default;
End;
Var AnyObject: TAnyClass; //
Begin
AnyObject.Strings[l]:==' ';
AnyObject[2]:='BTOpou - Default';
End.
) NoDefault , , . , , , Default.
) Stored , . Stored : True False, <\- . , Published .
Index
Index . / , Case Index.
|
|
:
.
, Index , Integer. , - , .
Delphi TSampleCalendar.
Type
TSampleCalendar=CIass(TCustomGrid) Private
Function GetDateElement(Index: Integer): Integer;
Procedure SetDateElement(Index: Integer; Value: Integer);
Public
Property Day: Integer Index 3 Read GetDateElement Write SetDateElement;
Property Month: Integer Index 2 Read GetDateElement Write SetDateElement;
Property Year: Integer Index 1 Read GetDateElement Write SetDateElement;
End;
Function TSampleCalendar.GetDateElement(Index: Integer): Integer;
Var AYear, AMonth, ADay: Word;
Begin
DecodeDate(FDate, AYear, AMonth, ADay); //
Case Index Of //
1: Result:=AYear;
2: Result:=AMonth;
3: Result:=ADay;
Else Result:=-l;
End;
End;
Procedure TSampleCaIendar.SetDateElement(Index: Integer; Value: Integer);
Var AYear, AMonth, ADay: Word;
Begin
If Value > 0 Then Begin
DecodeDate(FDate, AYear, AMonth, ADay); //
Case Index Of //
1: AYear;=Value;
2: AMonth:=Value;
3: ADay:=Value;
Else Exit;
End;
FDate:=EncodeDate(AYear, AMonth, ADay); //
Refresh;
End;
End;