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
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Shortcuts on 10.2 simulator

I am in the process of adding shortcuts to my application for Q/5/Q10 users, which is slightly complicated by the fact that I only have a touch device for testing (Z10). When I use a 10.1 simulator it all works as expected, but the same code on a 10.2 simulator doesn't trigger when the shortcut keys are pressed.

 

For instance, this works on a 10.1 simulator, but not on 10.2:

 

MyWebViewDescendent::MyWebViewDescendent() {
    this->inputRoute()->setPrimaryKeyTarget( true );

    bb::cascades::Shortcut* forceRefreshShortcut = bb::cascades::Shortcut::create().key( tr( "Alt + r" ) ).onTriggered( this, SLOT(myShortcutTriggeredHandler()) );
    this->addShortcut( forceRefreshShortcut );
}

void MyWebViewDescendent::myShortcutTriggeredHandler() {
    this->doStuff();
}

Note however that the built-in system shortcuts on the WebView work as expected. Only the ones I'm trying to add fail to trigger on the 10.2 simulator. Since I don't have a physical keyboard device I can't test that this is only an artifact of the simulator.

 

Has anyone else encountered this, and should I be implementing this a different way?



Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 141
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: Shortcuts on 10.2 simulator

If you review the documentation on shortcuts, it is implied that the only shortcuts that work with any UI control are control shortcuts, which are a subset of system shortcuts.  All other shortcuts seem to apply to action items only.  I believe that is why your shortcut code no longer works.  I suspect it only worked with the 10.1 simulator because this restriction wasn't being enforced.

 

My suggestion is to tie the shortcuts to action items if you can.  The action can still be connected to a particular slot in your WebView component.

Please use plain text.
Developer
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Shortcuts on 10.2 simulator

Yes, I did see that, and tried that already, but the result is the same. Even if it worked though it would be an issue on the front page of my app, where I don't have an ActionItem to attach to.

 

In any case, if you can't hook shortcuts to objects other than ActionItems, why are there member functions to do exactly that?


RSperanza wrote:

If you review the documentation on shortcuts, it is implied that the only shortcuts that work with any UI control are control shortcuts, which are a subset of system shortcuts.  All other shortcuts seem to apply to action items only.  I believe that is why your shortcut code no longer works.  I suspect it only worked with the 10.1 simulator because this restriction wasn't being enforced.

 

My suggestion is to tie the shortcuts to action items if you can.  The action can still be connected to a particular slot in your WebView component.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 141
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: Shortcuts on 10.2 simulator

One reason for adding it would be that there is an intention to support adding a shortcut to any control in the future so it was easier to add the method to a base class to make the API change once.  However, supporting the actual interaction for all controls may not be in place or it may not make sense for some controls that don't normally process text input.

 

Anyways, I have only ever seen custom shortcuts work on action items while testing them last time I looked at them.  I did find a reference to adding them to a container in the WebView documentation so maybe you can try attaching them to the container on your page and see if that works for you.

 

Otherwise, it could be a bug.  What OS are you testing with?

Please use plain text.
Developer
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Shortcuts on 10.2 simulator

Works with 10.1.0.1483 and 10.1.0.4780, fails on 10.2.0.1791.

 

Sorry, I understand what you are saying, but I just don't buy it that I'm doing something unsupported when it works fine on all 10.1 versions I've tried, but not on 10.2, especially since doing it the "official" way on 10.2 doesn't work either. I am much more inclined to believe this is like the huge invocation bugs that were introduced with 10.2... something that is supposed to work, and used to, but no longer does. What I DON'T know because I don't have a physical keyboard device to test it on is whether this is a BB10.2 problem, or just a simulator issue.

 

Is there anybody out there with a real Q5/10 that could do a quick test for me?

 


RSperanza wrote:

One reason for adding it would be that there is an intention to support adding a shortcut to any control in the future so it was easier to add the method to a base class to make the API change once.  However, supporting the actual interaction for all controls may not be in place or it may not make sense for some controls that don't normally process text input.

 

Anyways, I have only ever seen custom shortcuts work on action items while testing them last time I looked at them.  I did find a reference to adding them to a container in the WebView documentation so maybe you can try attaching them to the container on your page and see if that works for you.

 

Otherwise, it could be a bug.  What OS are you testing with?






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 141
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: Shortcuts on 10.2 simulator

Fair enough.  I can run a test on a Dev Alpha C to confirm. 

 

I can perform a QML test with one of my WebView samples first and if that works, I can try to recode the UI in C++ to further verify. 

 

I'll reply to this post again when I am done with the tests.

Please use plain text.
Developer
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Shortcuts on 10.2 simulator

Thanks very much.

 


RSperanza wrote:

Fair enough.  I can run a test on a Dev Alpha C to confirm. 

 

I can perform a QML test with one of my WebView samples first and if that works, I can try to recode the UI in C++ to further verify. 

 

I'll reply to this post again when I am done with the tests.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 141
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: Shortcuts on 10.2 simulator

Hi.

 

I confirmed that shortcuts work on WebViews defined in QML on 10.2 on the Dev Alpha C.  I just reached out to the simulator team to check whether there are any known issues with Shortcuts on the simulator.

Please use plain text.
Developer
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Shortcuts on 10.2 simulator

Thank you. The 10.2 simulator is still ignoring shortcuts for me, although they work fine on a 10.1 sim. I should point out that my shortcuts are defined from C++, but I doubt it makes any difference.

 

As long as they work on a real Q5/10 running BB10.2 I'm not too worried whether they are functional on a 10.2 simulator since I can test my code Ok on a 10.1 simulator. The challenge for me is that I don't have a Q5 or 10 for testing, only a Z10 or simulators so I'm afraid to release my latest upgrade that adds the shortcuts until I'm sure I won't be getting loads of bug reports from users on keyboard devices running 10.2.

 


RSperanza wrote:

Hi.

 

I confirmed that shortcuts work on WebViews defined in QML on 10.2 on the Dev Alpha C.  I just reached out to the simulator team to check whether there are any known issues with Shortcuts on the simulator.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
Developer
greenmr
Posts: 871
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Shortcuts on 10.2 simulator

I just got confirmation from a user in France running BB10.2.0.474 (OS10.2.0.1791) that the shortcuts do indeed work on her Q10, so it seems this problem only manifests on the 10.2 simulator. As I said before, the shortcuts work fine on the 10.1 simulator but do nothing on 10.2, although the built-in shortcuts DO work (top, bottom, scroll page, etc).

 

I have tested this with Simulator versions 10.2.0.1791 and 10.2.0.1803 and the custom shortcuts don't work with either.


RSperanza wrote:

Hi.

 

I confirmed that shortcuts work on WebViews defined in QML on 10.2 on the Dev Alpha C.  I just reached out to the simulator team to check whether there are any known issues with Shortcuts on the simulator.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.