Coding for both orientations

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Coding for both orientations

Post by richardmac » Sun Jan 02, 2011 11:18 pm

I've got an iPad app designed for one orientation (landscape) and when you turn the iPad to portrait, 30% of my graphics get cut off and the bottom of my graphic ends and shows a big empty white space. Rather than try to lock it down, I'm wondering which of the following two approaches is the best idea:

1. Use scripting to change the location of the graphisc and fields and buttons when the orientation is changed, or

2. Just extend the graphic out and sort of live with it not looking as good in portrait orientation.

Anyone looked at the best way to handle this yet?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Coding for both orientations

Post by Janschenkel » Mon Jan 03, 2011 6:29 am

I would go for option 1: script react to orientation changes, and move everything over to the best new location/size.
Unless the user interface just doesn't fit in the other orientation, you shouldn't lock the user into it.
Always design for the medium at hand...

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Coding for both orientations

Post by RickD » Wed Jan 05, 2011 8:25 pm

Hi richardmac,

A third option is to put all your logic into a separate substack and create two cards (one for portrait and one for landscape).
Then use the orientationChanged message to switch between cards.

I use it and it works quite well.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Coding for both orientations

Post by richardmac » Thu Jan 06, 2011 8:04 pm

That's a great idea. Could you maybe use this idea to have different screens for different hardware? On startup of the stack, you could check to see what the environment was, then switch to the appropriate card.

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Coding for both orientations

Post by hliljegren » Sat Jan 08, 2011 1:14 am

richardmac wrote:That's a great idea. Could you maybe use this idea to have different screens for different hardware? On startup of the stack, you could check to see what the environment was, then switch to the appropriate card.
Yes you can! I've tried this and it works great. I made a sub-stack for iPhone, one for iPhone Retina, one for iPad, but haven't yet made different cards for different orientations, but I would definitely go for a two card approach.
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: Coding for both orientations

Post by andyh1234 » Wed Jan 19, 2011 6:44 pm

Just to add, if you do set up two cards, make sure the orientationChanged message is at the card level, and not stack level.

Ive just spent 'a while' with my layout whirling round as the stack was getting so many orientationChanged messages, but when I moved them onto the appropriate cards all is now ok!

Post Reply