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: 25
Registered: ‎04-30-2011
My Device: Z10
My Carrier: AT&T

Re: Window Covers in WebWorks app issue

I just tried throwing some script tags around the items you mentioned and still no luck.

 

The webinspector is not coming back with any errors.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Window Covers in WebWorks app issue

I built the WindowCovers sample and it's working fine on my end. Can you send your project to me or compare what you've got in your code to what is in the sample?

 

twindsor@blackberry.com

Tim Windsor
Open Source Technical Lead
Developer
Posts: 25
Registered: ‎04-30-2011
My Device: Z10
My Carrier: AT&T

Re: Window Covers in WebWorks app issue

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Window Covers in WebWorks app issue

Finally figured it out. It's not obvious, but you need to delay that updateCover() call until you can be certain that the new cover is set. 

 

So change that part of the code to this:

 

blackberry.ui.cover.setContent(blackberry.ui.cover.TYPE_IMAGE, {
	path: 'local:///images/cover.png'
});
setTimeout(function(){
	blackberry.ui.cover.updateCover();
}, 0);

 That setTimeout(func, 0) call just puts it at the end of the call stack so it fires after the setContent call is done. Otherwise I was seeing the same as you - it worked about 1 in 10 times or less.

Tim Windsor
Open Source Technical Lead
Developer
Posts: 25
Registered: ‎04-30-2011
My Device: Z10
My Carrier: AT&T

Re: Window Covers in WebWorks app issue

Do I need to get rid of the

 

                }, false);
            }, false);

 

after the update cover?

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Window Covers in WebWorks app issue

No, you'll need those to end off the event listener code. 

Tim Windsor
Open Source Technical Lead
Developer
Posts: 25
Registered: ‎04-30-2011
My Device: Z10
My Carrier: AT&T

Re: Window Covers in WebWorks app issue

[ Edited ]

so it should look like this :

        <script src="local:///chrome/webworks.js" type="text/javascript"></script>
        <script type="text/javascript">
            /*global window, document, blackberry */

            window.addEventListener('load', function onload() {
                document.addEventListener('webworksready', function onwebworksready() {
                    blackberry.ui.cover.setContent(blackberry.ui.cover.TYPE_IMAGE, {
                    path: 'local:///images/cover.png'
                    });
                    setTimeout(function(){
                    blackberry.ui.cover.updateCover();
                    }, 0);
                }, false);
            }, false);
        </script>

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Window Covers in WebWorks app issue

That should be it.

Tim Windsor
Open Source Technical Lead
Developer
Posts: 25
Registered: ‎04-30-2011
My Device: Z10
My Carrier: AT&T

Re: Window Covers in WebWorks app issue

That did it! Thanks for your help!

Developer
Posts: 33
Registered: ‎10-29-2013
My Device: BB10
My Carrier: TMO

Re: Window Covers in WebWorks app issue

Hi Tim,

 

Can you please explain what is a snapshot mode in window covers? There are no examples on how to use it. Is it possible to display label on the top of the active frame but not on the bottom? Is there any way i can include in active frame a canvas generated image?

 

thanks