How to Simulate Pinch on BlackBerry 10 Simulator ?
Asked Answered
T

2

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)?

Telluride answered 27/5, 2012 at 16:43 Comment(6)
If it's not supported by the simulator, you may need to test with real hardware.Pelton
@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. :DTelluride
@Alex did you ever figure out if Pinch gesture is supported in simulator. Like how do you zoom in built in web browser????Kenti
@Kenti As I mentioned in the question, I am almost certain it is not supported. That is why I asked this question.Telluride
@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.Kenti
@Kenti 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.Telluride
A
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!

Algar answered 4/10, 2012 at 22:15 Comment(2)
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.Telluride
I'm on the case! I might be able to whip something together :)Algar
C
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

Curran answered 15/7, 2014 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.