Page 1 of 2
PORTRAIT and Landscape Orientation
Posted: Fri Jul 26, 2013 8:57 pm
by maxs
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
Re: PORTRAIT and Landscape Orientation
Posted: Fri Jul 26, 2013 9:29 pm
by FourthWorld
I believe the nest place for all such resizing would be in a resizeStack handler, no?
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 3:28 pm
by maxs
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.
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 4:00 pm
by FourthWorld
Hmmm...I had thought resizeStack would be sent in all circumstances which changed the stack rect, but perhaps try orientationChanged instead.
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 6:36 pm
by maxs
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?
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 6:54 pm
by Simon
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
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 6:59 pm
by maxs
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.
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 7:02 pm
by Simon
Hi Maxs,
But isn't that what you are asking it to do?
Simon
Re: PORTRAIT and Landscape Orientation
Posted: Sat Jul 27, 2013 10:57 pm
by dave_probertGA6e24
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
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 5:48 am
by maxs
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.
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 6:04 am
by Simon
Hi Maxs,
Try using "effective"
on resizeStack
set the rect of img "MP" to the effective screenRect
Simon
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 6:23 am
by maxs
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
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 6:35 am
by Simon
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.
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 5:26 pm
by maxs
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"
Re: PORTRAIT and Landscape Orientation
Posted: Sun Jul 28, 2013 5:36 pm
by Klaus
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!
Best
Klaus