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

Web and WebWorks Development

Reply
Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Active Frames issue

So I have the following code in my app:

 

		function onEnterCover() {
          $('#loc, .footnote, #bbm, #share, #info').hide();
          console.log('minimizing');
          blackberry.ui.cover.updateCover();
        }
        function onExitCover() {
            console.log('maximizing');
          $('#loc, .footnote, #bbm, #share, #info').show();
        }
        blackberry.event.addEventListener("exitcover", onExitCover);
        blackberry.event.addEventListener("entercover", onEnterCover);

 

I'm trying to hide / show some elements of the app to make the minimized version look better. With this code I see the console.log messages in my inspector but the elements don't get shown / hidden.

 

Can anyone tell me what I'm missing here?

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

BlackBerry Development Advisor
Posts: 760
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Active Frames issue

From my tests, it looks like once the entercover event triggers you can't modify the DOM quick enough to change how the cover is going to look.

Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: Active Frames issue

[ Edited ]

Since you are using jquery, try chaining the events, to make sure it finished hiding before minizing.

$('#loc, .footnote, #bbm, #share, #info').hide(function() {
// rest of the code here...
})

 

Nuno
Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Active Frames issue

The problem appears to be that when the entercover event fires you're basically 'too late' to make any changes to the page which is why the changes aren't visible in the snapshot. So even if I'd use the chaining it would still be too late. I'm starting to think it's currently just not possible to do this. There would need to be some 'beforeEnterCover' handler that would make the changes right before the rest happens.

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Highlighted
Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: Active Frames issue

I see... have you tried doing a

blackberry.ui.cover.resetCover();

 

after chaining the events and changing the interface. Just a guess... Smiley Happy

Nuno