dipanjan
dipanjan

Reputation: 85

TouchEvent in Blackberry 10

As far as I know there are four types of Touch Type in Blackberry 10-

  1. Down
  2. Move
  3. Up
  4. Cancel

In slot onTouch() I check for these four type of events and do some of my task there. Like below:

if (event->isDown())
{
    // implementing my task
}
if (event->isUp())
{
    // implementing my task
}
if (event->isMove())
{
    // implementing my task
}
if (event->isCancel())
{
    // implementing my task
}

So, what is my problem? While executing some of my task in isUp() codeblock and at the same time I touch the screen. But I am not getting any isDown() event in my code while my isUp() is running. After finishing the task inside isUp() then I get the isDown event.

My target is to get isDown() event while I am touching my screen to stop execution inside isUp().

How can I implement this into Blackberry 10?

Thanks in advance.

Upvotes: 0

Views: 118

Answers (1)

Benoit
Benoit

Reputation: 1921

I recommand to read this interesting blog article, to understand how UI rendering thread discuss with the application thread: http://devblog.blackberry.com/2012/09/cascades-custom-ui/

If your procces in "isUp" is this long, you have no other choice than doing it in a thread, and terminate the thread when "isDown" is called: http://developer.blackberry.com/cascades/reference/qthread.html#terminate

Upvotes: 3

Related Questions