Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IEventDelegate

interface IEventDelegate
Extends com.amazon.apmf.IStandard This interface provides functionality to customize the behaviour of pointer/key events. This is different from key/pointer event listener, as the default implementation does many things in addition to calling the listener, but if the user wants to modify the behaviour of how the event is dispatched and handled among the receiving view and its children, then the user can implement this interface and provides its instance. Each function of this delegate provides an additional parameter which holds a pointer to the default implementation of this delegate. This enables the user to call the base implementation of the function as per the use-case (similar to calling the parent class function from the overriden function in child class). See also- IViewModule::makeViewWithDelegate.

Methods

dispatchPointerEvent()

bool dispatchPointerEvent(IView* view, IUIPointerEvent* pointerEvent, IEventDelegate* defaultDelegate)
This function is called for the view which will get the pointer event after performing hit test. Hit testing will return a list of views which are in range for receiving the pointer event. The framework will iterate over all the views returned by hit test and call this function for each of the views. We will pass the pointer event to each of these views until a view is found which returns true (meaning that view has consumed the pointer event). For each of the remaining views, this function will be called with the pointer event argument in cancelled state, to allow for cleanup. By default, it will call the pointer event listeners added to this view and mark the pointer event as consumed, so that it is not propagated any more.

Parameters

view
IView* — Required IView Instance of the view which is receiving the pointer event.
pointerEvent
IUIPointerEvent* — Required IUIPointerEvent Instance of pointer event which contains information about the pointer data.
defaultDelegate
IEventDelegate* — Required IEventDelegate Pointer to the default implementation of IEventDelegate.

Returns

bool bool True if the view has consumed the pointer event and vice-versa.

dispatchKeyEvent()

bool dispatchKeyEvent(IView* view, IUIKeyEvent* key, IEventDelegate* defaultDelegate)
This function is called for the view to allow for consumption of key event. This function will be called one by one for each of the views starting from the root view. By default, this function will call the key listeners if this view is focused, else it will call this function for the focused child. If both of these conditions return false, then the next child of the root view will receive this callback. If all the views return false, then focus change if performed for this key event.

Parameters

view
IView* — Required IView Instance of the view which is receiving the key event.
key
IUIKeyEvent* — Required IUIKeyEvent Instance of key event which contains information about the key data.
defaultDelegate
IEventDelegate* — Required IEventDelegate Pointer to the default implementation of IEventDelegate.

Returns

bool bool True if the view has consumed key event and vice-versa.

dispatchAxisEvent()

bool dispatchAxisEvent(IView* view, IUIAxisEvent* axisEvent, IEventDelegate* defaultDelegate)
This function is called for the view to allow for consumption of axis event. This function will be called one by one for each of the views starting from the root view. By default, this function will call the event listeners if this view is focused, else it will call this function for the focused child. If both of these conditions return false, then the next child of the root view will receive this callback. If all the views return false, then focus change is performed for this event.

Parameters

view
IView* — Required IView Instance of the view which is receiving the axis event.
axisEvent
IUIAxisEvent* — Required IUIAxisEvent instance which contains information about the axis data.
defaultDelegate
IEventDelegate* — Required IEventDelegate Pointer to the default implementation of IEventDelegate.

Returns

bool bool True if the view has consumed key event and vice-versa.
Last modified on October 29, 2026