语言

Menu
Sites
Language
GenerateKeyEvent() followed by GenerateTouchEvent()

Hi,

I have created a service application that will simulate Key and touch Events in OnAppInitialized(). I need to simulate first touch followed by key events instead i key events are coming first followed by touch events.

Code snippet :

result r = Tizen::Ui::SystemUtil::GenerateTouchEvent(Tizen::Ui::TOUCH_EVENT_TYPE_PRESSED, Tizen::Graphics::Point(360, 970));
AppLog("TOUCH_EVENT_TYPE_PRESSED and result :: %s", GetErrorMessage(r));

r = Tizen::Ui::SystemUtil::GenerateTouchEvent(Tizen::Ui::TOUCH_EVENT_TYPE_RELEASED, Tizen::Graphics::Point(360,970));
AppLog("TOUCH_EVENT_TYPE_RELEASED and result :: %s", GetErrorMessage(r));

sleep(20);
	
Tizen::Ui::KeyCode keyToSimulate = Tizen::Ui::KEY_A;

r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_PRESSED, keyToSimulate);
AppLog("KEY_EVENT_TYPE_PRESSED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));

r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_RELEASED, keyToSimulate);
AppLog("KEY_EVENT_TYPE_RELEASED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));

No matter how i simulate the events end result key events takes the priority.

Could any one of you please help me.

Regards,

Anil

 

 

 

 

 

响应

1 回复
Md. Anwar Parvez

Hello Anil Kumar,

Mentioned API for generating event is deprecated in TIzen 2.4.

For custom event handling you can check from https://developer.tizen.org/development/tutorials/native-application/application-framework/application/event#broadcast

This article may also help to handle touch gesture -> https://developer.tizen.org/development/ui-practices/native-application/efl/ui-component-infrastructure-modules/handling-touch-gestures

For any further information, feel free to ask.