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
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator
Accepted Solution

TouchDown gets activated a bit outside my Container area??

Hi, below is the code where I habdle TouchDown events

of my container. The small problem with this code is that

I noticed that if I click with my mouse a bit outside the Container

area, the TouchDown still gets activated, why is this the case?? Thanks.

 

   Container {
                       horizontalAlignment: HorizontalAlignment.Center
                       property alias text: label.text
                       property alias image: imagev.imageSource
                                             
                       layout: DockLayout {}
                       
                       ImageView {
                           minWidth: 600.0
                           maxWidth: 600.0
                           minHeight: 100
                           maxHeight: 100
                           horizontalAlignment: HorizontalAlignment.Center
                           verticalAlignment: VerticalAlignment.Center
                                          
                           id: imagev
                           imageSource: "asset:///btn-green.png"
                       }        
                 
             
            
                       onTouch: {
                             if (event.isDown() ) {
                                     imagev.imageSource = "asset:///btn-lightblue.png";
                             } else if (event.isUp()) {
                                    imagev.imageSource = "asset:///btn-green.png";
                             } else if (event.isCancel()) {
                                    imagev.imageSource = "asset:///btn-green.png";
                             }
                      }
           
                   }

 

Please use plain text.
Developer
Curahee
Posts: 210
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: TouchDown gets activated a bit outside my Container area??

This is the case because a finger is not a mouse. It's impossible to click on a pixel with your finger because a finger is something like 40px by 40px. That is the reason when you click a little bit outside a button, the button still gets activated. I think this is the case on every platform (Android, iOS, Windows Phone) to just improve the user experience.

 

It's very annoying when the button is to small to touch decently with a finger...

______________________________________________________
beRail: BlackBerry World - GitHub
Mobile Vikings: BlackBerry World - GitHub
Park in Brussels: BlackBerry World
Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)
My Carrier: Mobile Vikings

Re: TouchDown gets activated a bit outside my Container area??

Curahee's right, it's just a bit of frustration-avoiding that's going on. It won't feel weird on the device.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: TouchDown gets activated a bit outside my Container area??

OK, thanks for explanations to both of you.

Please use plain text.