) DispID Dispatch , OLE. Dispatch . , Automated . , .
) Implements . , .
- ,
.
) - , Public Published, .. .
Public Property MyProperty;
) / (Read] Write|Stored|Default|NoDefault). .
) . (Read|Write). .
, . . , . , .
, . , .
Type
TlstClass=Class //
FFId: Integer; //
Function Getint: Integer; //
Procedure Setlnt(lnt: Integer); //
Property Prop: Integer Read Getint Write Setint; //
End;
T2ndClass=Class(TlstClass) II
Function GetStr: String; II
Procedure SetStr(St: String); II
Property Prop: String Read GetStr Write SetStr; //
End;
Var Objl: TIstClass; II
Obj2: TZndClass; //
:
Procedure TForml.ButtonlClick(Sender: TObject);
Begin
Editl.Text:=IntToStr(Objl.Prop); II 1- Edit2.Text:=T2ndClass(Obj l).Prop; II 1-
|
|
End;
Procedure TFonnl.Button2Click(Sender: TObject);
Begin
Edit3.Text:=Obj2.Prop; II 2- Edit4.Text:=IntToStr(TlstClass(Obj2).Prop); // 2-
End;
Procedure TForinl.Button3Click(Sender: TObject);
Begin
Edit5.Text:=T2ndClass(Objl).Prop; II 1-
End;
, Edit5 . , . . .
) Implements , .
(EVENTS)
- , , . , , .
, - , .
. , . . , , .
, , . . Delphi , .
: . Windows, , -, . Windows.
, , . .
, , , . TNotifyEvent, - . OnClick - . - . . , , - , , .
, , , , . , - , , , , . , . . .
|
|
:
Property < >: < > [Index < } [Read < >] [Write < \ >} [Stored >} [Default Nil|NoDefault];
:
, . .
Index . , Index .
Default - Nil, . Default , , NoDefault .
Delphi "On ": OnCreate, OnClick ..
OnClick TControl :
Type
TControl=Class(TComponent) Private
FOnClick; TNotifyEvent; // none
Function IsOnClickStored: Boolean;
II Protected
Procedure Click; Dynamic; //
Property OnClick: TNotifyEvent Read FOnClick Write FOnClick
Stored IsOnClickStored; //
End;
TNotifyEvent.
, :
( );
;
( - event-dispatching method) , , . ;
.
. , . .
) .
- , . , , . , , . , - , Delphi .
, , Delphi . - . , . , , , , . , (event handler), - (event driven).
, . , :
Type < >=Procedure(Sender: T0bject[; <>}) Of Object;
Of Object , , . , Delphi , ( Self), .
|
|
. Delphi - . , , .
, , , Var .
Type TKeyPressEvent=Procedure(Sender: TObject; Var Key: Char) Of Object;
, , :
Procedure TForml.EditlKeyPressed(Sender: TObject; Var Key: Char);
Begin
Key:=UpCase(Key);
End;
Var , .
, , - . , Delphi :
Type THelpEvent=Function(Command: Word; Data: Longint;
Var CallHelp: Boolean): Boolean Of Object;
Property OnHelp: THelpEvent;
Delphi ' . .2.
TCloseEvent=Procedure(Sender: TObject; Var Action: TCloseAction) Of Object; | OnClose |
TDockDropEvent=Procedure(Sender: TObject; Source: TDragDockObject; X, Y: Integer) Of Object; | OnDockDrop |
TDockOverEvent=Procedure(Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState;Var Accept: Boolean) Of Object; | OnDockOver |
TStartDockEvent=Procedure(Sender: TObject; Var DragObject: TDragDockObject) Of Object; | OnStartDock |
TStartDragEvent=Procedure(Sender: TObject; Var DragObject: TDragObject) Of Object; | OnStartDrag |
TActionEvent=Procedure(Action: TBasicAction; Var Handled: Boolean) Of Object; | OnActionExecute, OnUpdate, OnExecute, OnActionUpdate, |
TContextPopupEvent=:Procedue(Sende: TObject; MousePos: TPoint, Var Handled: Boolean) Of Object; | OnContextPopup |
, . Internet .. Delphi. , .
) .
, () . , , , .
- , , . , OnClick .
, . , .
) , . , , ( ) , . . .
|
|
() .
, Click, ( ""), , , .
:
Procedure < >[(<>)]; Dynamic;
, OnMouseMove TControl :
Procedure MouseMove(Shift: TShiftState; X, Y: Integer); Dynamic;
Implementation . , .
RTL Delphi , Windows. . . , , , , , .
:
Procedure < >.< >[(< >)];
Begin
< > If Assigaed(<none >)
Then < co6bimw>(Self[, '^ >]);
< > End;
, OnMouseMove Controls :
Procedure TControl.MouseMove(Shift: TShiftState; X, Y: Integer);
Begin