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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Simulating Clicked event using onTouch

Hi,

 

I have overriden a onTouch event for my container. What I want basically

is to respond to "clicks" on my container (just like button clicks). How

to achieve similar functionality to a "click" using the onTouch????

 

I mean how to know, using an onTouch, that an action similar to "click" has occured???

 

When I have purely

onTouch { .. some action ... }

 I think this gets called twice, once when the user clicks the container area, and second time, once the user

releases the mouse button.

Contributor
Posts: 43
Registered: ‎01-05-2013
My Device: Dev Alpha
My Carrier: Telenor Hungary

Re: Simulating Clicked event using onTouch

Hi,

 

here is the reference for onToch with some sample codes:

 

http://developer.blackberry.com/cascades/documentation/dev/touch/touch_propagation.html

 

cheers,

chriske

--------------------------------------------------------------
If my post was helpful or it was the solution for Your problem, please don't forget to give me a like, and mark my post as a solution. Thanks!
Highlighted
New Developer
Posts: 15
Registered: ‎02-12-2013
My Device: Bold 9900 - Z10 LE - DAC - Playbook

Re: Simulating Clicked event using onTouch

What about using the TapHandler as a gestureHanlder on your container ... works fine for my usecase.

Container{

gestureHandlers: [
            TapHandler {
                onTapped: {
                        ... some action ...

                   }
                }
            }
        ]

}

---------------------------------------------------------------------------------------------
Prompter: BlackBerry World - Built for BlackBerry™
Prompter4Q: BlackBerry World - Built for BlackBerry™
Developer
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: Simulating Clicked event using onTouch

I am not sure which is better, more common. I guess i will have a look at both. btw. OnTapped -- is it similar to a "clicked" event? e..g, like with buttons? thanks.
New Developer
Posts: 15
Registered: ‎02-12-2013
My Device: Bold 9900 - Z10 LE - DAC - Playbook

Re: Simulating Clicked event using onTouch

As far as i'm aware, there is no "up" or "down" state like you have with the onTouch (cfr your calling twice of the event), but do correct me if i'm wrong ("new" developer on this OS).

More info can be found here: http://developer.blackberry.com/cascades/documentation/dev/touch/index.html

You can also add DoubleTapHandlers and LongPressHandlers to differentiate various scenario's/gestures.

---------------------------------------------------------------------------------------------
Prompter: BlackBerry World - Built for BlackBerry™
Prompter4Q: BlackBerry World - Built for BlackBerry™
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Simulating Clicked event using onTouch

Hi,

 

These events can be differentiated:

 

onTouch: {
  if (event.isDown()) {
    // ...
  }
}

 


Andrey Fidrya, @zmeyc on twitter