PORTRAIT and Landscape Orientation

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

PORTRAIT and Landscape Orientation

Post by maxs » Fri Jul 26, 2013 8:57 pm

I want to automatically resize a graphic when the user turns the ipad to change its orientation.

I have this code:
SET THE RECT of img "bg" to the rect of this card

Where do I put this message?

Thanks, Max

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by FourthWorld » Fri Jul 26, 2013 9:29 pm

I believe the nest place for all such resizing would be in a resizeStack handler, no?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sat Jul 27, 2013 3:28 pm

I tried this, and its works fine for initial orientation.But when I rotate the IPAD left, the resizeStack message does no seem to get called. Am I missing something?

on resizeStack
set the rect of img "MP" to the rect of this window
set the top of img "MP" to ( the top of this window- 64)
set the left of img "MP" to ( the left of this window- 661)
end resizeStack


Thank you Richard.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by FourthWorld » Sat Jul 27, 2013 4:00 pm

Hmmm...I had thought resizeStack would be sent in all circumstances which changed the stack rect, but perhaps try orientationChanged instead.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sat Jul 27, 2013 6:36 pm

I tried every concievable way to use resizestack and Orientationchanged, but the shape keeps distorting out of the window.

Has anyone had success resizing images for different orientations?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: PORTRAIT and Landscape Orientation

Post by Simon » Sat Jul 27, 2013 6:54 pm

Hi Maxs,
I've had no problem before.
But the -64 and - 661 will push the image off the screen since it's the same size as the stack.
What do you want to happen?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sat Jul 27, 2013 6:59 pm

Hi Simon

I just want to set the rect of img "MP" to the rect of this window

But the image keeps shifting right and down when I change the orientation.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: PORTRAIT and Landscape Orientation

Post by Simon » Sat Jul 27, 2013 7:02 pm

Hi Maxs,
But isn't that what you are asking it to do?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: PORTRAIT and Landscape Orientation

Post by dave_probertGA6e24 » Sat Jul 27, 2013 10:57 pm

Instead of setting the top and left, set the loc. For landscape it will be 512,384 and portrait: 384,512 (assuming iPad non-retina)

Also check your settings for the iOS output - there are 4 checkboxes at the bottom of the left column - make sure they are all ticked.

Also try the resizeStack handler on the card as opposed to the stack level script - for me the stack level one didn't actually get called! But when I moved the same handler to the card it worked perfectly!

Hope some of that helps.

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sun Jul 28, 2013 5:48 am

Hi Simon,

No I was using the offset to compensate to the extra margins the seem to appear for no reason. But that only made the problem worse.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: PORTRAIT and Landscape Orientation

Post by Simon » Sun Jul 28, 2013 6:04 am

Hi Maxs,
Try using "effective"
on resizeStack
set the rect of img "MP" to the effective screenRect

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sun Jul 28, 2013 6:23 am

Thanks, Simon for staying with me.

the set the rect of img "MP" to the effective screenRect gives an error.

For some reason when I try to set the rect of any object to the window, I get a 1 inch border.

I'm thinking of trashing my preferences folder.

Does anyone remember where the Livecode preferences are stored?

Max

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: PORTRAIT and Landscape Orientation

Post by Simon » Sun Jul 28, 2013 6:35 am

OH,
I think it might be:
effective working screenRect

Simon
EDIT: I've never heard of people using "window" to fill the screen with an image. screenRect, yes.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by maxs » Sun Jul 28, 2013 5:26 pm

THanks again Simon,

Using the word "working" helped. I have a big monitor to the image really zoomed out.

I also found this to help

set the rect of img "MP" to the rect of this window
set the top of img "MP" to "0"
set the left of img "MP" to "0"

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: PORTRAIT and Landscape Orientation

Post by Klaus » Sun Jul 28, 2013 5:36 pm

Simon,
Simon wrote:I've never heard of people using "window" to fill the screen with an image. screenRect, yes.
-> window
and its abbreviation
-> wd
is a snyonym for stack!

Just looked this up in the dictionary and FINALLY know the abbreviation for STACK! :-D


Best

Klaus

Post Reply