Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 49
Registered: ‎03-27-2013
My Device: z10
My Carrier: Banglalink
Accepted Solution

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.

 

Developer
Posts: 1,523
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: TouchEvent in Blackberry 10

Hi,

A better forum section for this question is Cascades one.

Do not perform lengthy operations in signal handlers. This will block the event processing loop which isn't a good idea.

If you need to wait before performing another action, use a timer (QTimer) to schedule another method to execute later. It's a C++ class and you'll have to export it to QML first.

In case you're performing a CPU intensive calculation, start a new thread for it.

Andrey Fidrya, @zmeyc on twitter
Retired
Posts: 54
Registered: ‎06-26-2012
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: TouchEvent in Blackberry 10

Zmey is rigth, you need to create another thread and send signals to it. You could convert your touch events into
pulses (MsgSendPulse()) to this thread and then do what ever you want in this thread.