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
Contributor
grrd25
Posts: 10
Registered: ‎06-08-2012
My Device: developer

Re: How does the touch input work on the playbook simulator? Urgent!! please answer me

Thanks a lot, the example works I didn't know you had to touch the upper black section (though that was always the tablet menu) Looking the code I see that it handles both clicks and tuches with different instructions which was kind of my first question.

 

I had given up on getting an answer, I even had started looking into HTML5.

BlackBerry Development Advisor (Retired)
gperry
Posts: 138
Registered: ‎05-11-2012
My Device: Developer

Re: How does the touch input work on the playbook simulator? Urgent!! please answer me

Glad we could help.

 

Graham

New Member
jehelam
Posts: 2
Registered: ‎10-18-2011
My Device: Playbook, Bold

Re: How does the touch input work on the playbook simulator? Urgent!! please answer me

The simulator does not support touch events, only mouse events.  So to make code interchangeable between a real device using touch and the simulator you have to support both touch and mouse events, and make them do the same thing.  See this relevant snippet from GoodCitizen:

 

    if (screen_val == SCREEN_EVENT_MTOUCH_RELEASE) {
        //Handle touch screen event
        handleClick(pair[0], pair[1]);

    } else if (screen_val == SCREEN_EVENT_POINTER) {
        //This is a mouse move event, it is applicable to a device with a usb mouse or simulator
        screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS,
                &buttons);

        if (buttons == SCREEN_LEFT_MOUSE_BUTTON) {
            //Left mouse button is pressed
            mouse_pressed = true;
        } else {
            if (mouse_pressed) {
                //Left mouse button was released, handle left click
                handleClick(pair[0], pair[1]);
                mouse_pressed = false;
            }
        }
    }

 

New Contributor
chocolatemoose
Posts: 8
Registered: ‎01-05-2012
My Device: Playbook

Re: How does the touch input work on the playbook simulator? Urgent!! please answer me

[ Edited ]

EDIT - I somehow missed the post above - you can ignore :smileywink:

 

Not sure if you've already worked this out - but from everything I can work out, it looks suspiciously like the simulator actually doesn't support true touch events.

 

Based on this documentation:

http://developer.blackberry.com/native/beta/documentation/porting_ios_input_and_sensors.html

 

It suggests you need to add support for SCREEN_EVENT_POINTER events to get events back from the simulator (or a USB mouse).

 

Once I added this code path in, I can now interact with my app in the simulator (though I'll admit it's a bit unnerving having a totally different input path).

 

I could of course me missing something here myself - but perhaps it helps you a bit.