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
d_source
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified
Accepted Solution

Adapting to screen orientation using javascript (for playbook)

Hi All,

 

I know the screen orientation topic has been gone through many times already, but i've searched and searched in the webworks thread for an answer and can't find it.

 

My app is made for landscape. I have 2 options. 1) Lock the app into landscape which I beleive still can't be done using webworks (but please correct me if i am worng) or 2) scale the app for portrait.

 

Since to my knowledge 1) cannot be done, i'll focus on 2). Has anyone seen or written a javascript/css script which will check if the user is holding the tablet in landscape or portrait and adapt to switching b/w the 2 on the fly? My app is made for 1024x600. I know it can be scaled using the CSS on startup to 0.6 to fit the screen, but i am not sure how to check and then re-scale afterward with javascript.

 

Any help, please and thanks.

 

 

Developer
ChanneledDan
Posts: 29
Registered: ‎02-25-2011
My Device: PlayBook

Re: Adapting to screen orientation using javascript (for playbook)

[ Edited ]

Actually, you can lock it in landscape orientation by putting

 

<rim: orientation mode="landscape" />

 

in your config.xml. Just remove the space after "rim:" because I added it to prevent the message board from rendering it as :smileysurprised:, haha.

--------------------------------------
PlayBook Apps: EveryDay Converter
Developer
d_source
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: Adapting to screen orientation using javascript (for playbook)

This worked great!!! Thanks so much for this. I spent so much time looking into resizing for flipping, this is so much easier and the game is in its proper format now.

New Developer
liangjiu2008
Posts: 7
Registered: ‎06-08-2012
My Device: developer

Re: Adapting to screen orientation using javascript (for playbook)

Your method is available, and  solves my problem which puzzled me for many days.

Thank you!