delphi FMX常用事件类型及其别名
一、System.Classes {标准事件 Standard events }
type
TNotifyEvent = procedure(Sender: TObject) of object;
TGetStrProc = procedure(const S: string) of object;
二、TControl class(TFmxObject, IControl, IContainerObject, IAlignRoot, IRotatedControl, IAlignableObject,
IEffectContainer, IGestureControl, ITabStopController, ITriggerAnimation, ITriggerEffect)
public
property CustomSceneAddRect: TCustomSceneAddRectEvent read FCustomSceneAddRect write FCustomSceneAddRect;
property OnDragEnter: TDragEnterEvent read FOnDragEnter write FOnDragEnter;
property OnDragLeave: TNotifyEvent read FOnDragLeave write FOnDragLeave;
property OnDragOver: TDragOverEvent read FOnDragOver write FOnDragOver;
property OnDragDrop: TDragDropEvent read FOnDragDrop write FOnDragDrop;
property OnDragEnd: TNotifyEvent read FOnDragEnd write FOnDragEnd;
property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown;
property OnKeyUp: TKeyEvent read FOnKeyUp write FOnKeyUp;
property OnClick: TNotifyEvent read FOnClick write SetOnClick stored OnClickStored;
property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;
property OnCanFocus: TCanFocusEvent read FOnCanFocus write FOnCanFocus;
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
property OnExit: TNotifyEvent read FOnExit write FOnExit;
property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;
property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
property OnPainting: TOnPaintEvent read FOnPainting write FOnPainting;
property OnPaint: TOnPaintEvent read FOnPaint write FOnPaint;
property OnResize: TNotifyEvent read FOnResize write FOnResize;
property OnResized: TNotifyEvent read FOnResized write FOnResized;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnApplyStyleLookup: TNotifyEvent read FOnApplyStyleLookup write FOnApplyStyleLookup;
published
property Touch: TTouchManager read GetTouchManager write SetTouchManager;
property OnGesture: TGestureEvent read FOnGesture write FOnGesture;
property OnTap: TTapEvent read FOnTap write FOnTap;
end;
三、FMX.Types
3.1、别名事件
TMouseEvent = procedure(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single) of object;
TMouseMoveEvent = procedure(Sender: TObject; Shift: TShiftState; X, Y: Single) of object;
TMouseWheelEvent = procedure(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean) of object;
TKeyEvent = procedure(Sender: TObject; var Key: Word; var KeyChar: WideChar; Shift: TShiftState) of object;
TProcessTickEvent = procedure(Sender: TObject; time, deltaTime: Single) of object;
TVirtualKeyboardEvent = procedure(Sender: TObject; KeyboardVisible: Boolean; const Bounds : TRect) of object;
TTapEvent = procedure(Sender: TObject; const Point: TPointF) of object;
TTouchEvent = procedure(Sender: TObject; const Touches: TTouches; const Action: TTouchAction) of object;
3.2、事件接口类,比如:
IFreeNotification = interface
['{FEB50EAF-A3B9-4b37-8EDB-1EF9EE2F22D4}']
procedure FreeNotification(AObject: TObject);
end;
IFreeNotificationBehavior = interface
['{83F052C5-8696-4AFA-88F5-DCDFEF005480}']
procedure AddFreeNotify(const AObject: IFreeNotification);
procedure RemoveFreeNotify(const AObject: IFreeNotification);
end;
四、System.Types
4.1、异步多线程事件
/// <summary>
/// Interface returned from various "BeginXXX" methods in order to provide asynchronous execution of code.
/// </summary>
IAsyncResult = interface
/// <summary>
/// Returns an event suitable for use to block until the asynchronous call is complete. This event is also suitable for
/// use in a list to allow waiting for all or any to be signaled. See the TMultiWaitEvent.WaitForXXX class
/// functions.
/// </summary>
function GetAsyncWaitEvent: TMultiWaitEvent;
/// <summary>
/// Event suitable for use to block until the asynchronous call is complete. This event is also suitable for
/// use in a list to allow waiting for all or any to be signaled. See the TMultiWaitEvent.WaitForXXX class
/// functions.
/// </summary>
property AsyncWaitEvent: TMultiWaitEvent read GetAsyncWaitEvent;
TMultiWaitEvent = class abstract
public
/// <summary>
/// Rather than use a constructor which will create an instance of <strong>this</strong> class, this will
/// return an instance of the registered descendent type that provides the actual implementation.
/// </summary>
class function Create: TMultiWaitEvent; static;
/// <summary>Wait until at least one of the indicated TMultiWaitEvents are signaled or Timeout is reached.
/// Returns the TMultiWaitEvent instance which was signaled and caused the function to return. Event is
/// undefined if Timeout is reached.
/// </summary>
class function WaitForAny(const Events: array of TMultiWaitEvent; out Event: TMultiWaitEvent; Timeout: Cardinal = INFINITE): TWaitResult; overload; static;
5、System.Classes
5.1、异步事件
TAsyncProcedureEvent = procedure (const ASyncResult: IAsyncResult) of object;
TAsyncFunctionEvent = procedure (const ASyncResult: IAsyncResult; out Result: TObject) of object;
TAsyncConstArrayProcedureEvent = procedure (const ASyncResult: IAsyncResult; const Params: array of const) of object;
TAsyncConstArrayFunctionEvent = procedure (const ASyncResult: IAsyncResult; out Result: TObject; const Params: array of const) of object;