Note: In the first two cases the feedback must be generated on the pointer down event, even though the related action itself would be done only on the pointer up event.
In a lot of cases, you may want to use both area registry based feedback and direct feedback in your application. In this case you must ensure these two do not overlap, so that direct feedback would be generated for some pointer events, which have already triggered feedback from the area registry.
Use the InstantFeedback
function to generate direct feedback.
This always causes a synchronous client-server transaction immediately. (If
tactile feedback is not supported in the device, the API implementation ignores
the function call.)
void CMyTactileEnabledControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) { TBool stateChanged; // (your code here) if(aPointerEvent.iType == TPointerEvent::EDrag && stateChanged) { // Produce sensitive feedback when dragging causes a state // change (this kind of feedback triggering is not possible // by using area registry). MTouchFeedback* feedback = MTouchFeedback::Instance(); if ( feedback ) { feedback->InstantFeedback( ETouchFeedbackSensitive ); } } }
Also notice that there are two overloads of the InstantFeedback
function:
The first one only takes the logical feedback type as parameter, and can be
used for generating feedback at any time, even when no UI controls are involved
(for e.g. if the AppUi class wants to generate feedback). The second overload
takes a CCoeControl
pointer as parameter, and it does nothing
in case feedback is disabled for the given control.
The latter overload is recommended to be used from UI controls, because that gives the owner of the control a possibility to disable both area registry based and direct feedback if needed.