16

I am developing a project using the Native SDK for BlackBerry 10. I am using BlackBerry 10 Dev Alpha Simulator for testing purposes. I can't seem to simulate a pinch event, and did some searching just to find out that this is not implemented yet in the simulator.

So basically, I need a method to programatically create a pinch and run it when some other event is triggered. What is the easiest way to do this?

Edit:

I am not looking for language-agnostic solutions. I need an architectural implementation. How would one go on using gesture_pinch_t to create a pinch event (even with hardcoded parameters)?

RzR
  • 2,889
  • 26
  • 25
  • If it's not supported by the simulator, you may need to test with real hardware. – Ben Voigt May 27 '12 at 16:51
  • @Ben Voigt It will get tested eventually. It simply appears that I don't have access to a device, only a simulator. Feel free to send me a BlackBerry Playbook 2.0 if you like. :D –  May 27 '12 at 19:01
  • @Alex did you ever figure out if Pinch gesture is supported in simulator. Like how do you zoom in built in web browser???? – Fraggle Feb 02 '13 at 16:38
  • @Fraggle As I mentioned in the question, I am almost certain it is not supported. That is why I asked this question. –  Feb 02 '13 at 20:44
  • @Alex, so on Simulator you can't even zoom in when using the built in browser app on a web page? seems weird that they would leave that out. – Fraggle Feb 03 '13 at 16:26
  • @Fraggle Android emulators also don't have pinch (at least not purely by software). Weird or not, I don't believe there is a hidden non-documented 'hint' that would enable to magically pinch. If there was a way, they would probably have told us. –  Feb 05 '13 at 17:06

2 Answers2

4

I'm more involved with the WebWorks and AIR team at RIM, but off the top of my head a language agnostic solution would be something like the following:

  • You have some handler for the pinch event, which is able to process the data passed by the event (gesture_pinch_t)
  • Instead of using the pinch event to trigger the callback, you can simulate a pinch with some other obtainable event (perhaps a double tap or a test toggle button that you turn on and then all touch events become the start of a simulated pinch).
  • You then make the centroid property your starting coordinate, and then as you drag with your finger (or in this case, with your cursor in the simulator), you calculate the distance property by subtracting the current coordinate with the origin coordinate you made your centroid.

Again, I haven't delved into the NDK specifically, but this is the approach I would take with JavaScript or ActionScript and is quite do-able. I wish I could write a code snippet but hopefully this helps take you in the right direction.

Cheers!

Graham Robertson
  • 793
  • 4
  • 10
  • Can you provide a code sample on how one would manually create a `gesture_pinch_t` and use it to actually simulate the pinch? I was aware of its existence before posting the question, but how would you go on using it in the event flow after creation? I don't think this is covered in their documentation or any code samples. –  Oct 05 '12 at 20:54
  • 1
    I'm on the case! I might be able to whip something together :) – Graham Robertson Oct 10 '12 at 14:38
0

Just to let you know that multiple touch gestures are now supported in the simulator. Just right click and drag to add a touch event, do it again to simulate more touch events, then left click to execute them at the same time.

Example of pinch gesture:

enter image description here

donturner
  • 12,337
  • 7
  • 46
  • 71