Hi,
I'm trying to develop a mobile app that will adjust to the device screen resolution.
When starting in debug, the screenRect value seems to return the computer monitor size rather than any reasonable mobile device size, even though I only have iphone/ipod set in the standalone settings.
Is it possible to set the debug "screen size" & orientation in livecode so sensible values are seen (from screenRect etc) while debugging?
Thanks,
RJ.
Mobile device "size" during development
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Mobile device "size" during development
Hi R.J.
When I develop mobile apps for Android, I always use the width and height of the current card to determine how to adjust the layout of that card. So in the resizeStack function I use:
and then define two functions elsewhere that change the layout of the screen:
I also use the resizeStack logic in the preOpenCard handler so that the resize works on mobile devices when not in debug mode.
In debug mode, all you need to do is resize the stack through the property inspector or with the mouse. It's pretty easy to see what the app will look like on all sorts of device resolutions and in the different orientations.
Hope that helps,
Jacob
When I develop mobile apps for Android, I always use the width and height of the current card to determine how to adjust the layout of that card. So in the resizeStack function I use:
Code: Select all
on resizeStack
if the width of this card < the height of this card then
resizePortrait
else
resizeLandscape
end if
end resizeStack
Code: Select all
on resizePortrait
put the width of this card into tW
put the height of this card into tH
set the width of field "Instructions" to (1*tW)
set the height of field "Instructions" to (.121*tH)
...
end resizePortrait
on resizeLandscape
put the width of this card into tW
put the height of this card into tH
set the width of field "Instructions" to (.5*tW)
set the left of field "Instructions" to (.05*tW)
...
end resizeLandscape
In debug mode, all you need to do is resize the stack through the property inspector or with the mouse. It's pretty easy to see what the app will look like on all sorts of device resolutions and in the different orientations.
Hope that helps,
Jacob
-
- Posts: 12
- Joined: Tue Feb 17, 2015 1:30 pm
Re: Mobile device "size" during development
Hi,
thanks, I'd not thought of checking the size of the card.
It looks like there is a bug in the screenrect function.
RJ.
thanks, I'd not thought of checking the size of the card.
It looks like there is a bug in the screenrect function.
RJ.
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Mobile device "size" during development
Hi RJ - remember the screenRect returns the size of the screen(s) the computer is running and not your app - so invoking it on your computer will indeed return the size of your monitor (have you tried calling it when your app is on a mobile device?
Kind regards
Dave
Kind regards
Dave
"...this is not the code you are looking for..."
Re: Mobile device "size" during development
Dave is absolutely right! The screenRect function is working exactly as it should: it returns the size of the screen, not the card!
I would definitely recommend using the dimensions of the card (or the stack) for mobile development. It makes developing in the LiveCode IDE much easier.
Jacob
I would definitely recommend using the dimensions of the card (or the stack) for mobile development. It makes developing in the LiveCode IDE much easier.
Jacob