Resizing group to match size of device screen

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Resizing group to match size of device screen

Post by rleiman » Sun Jan 06, 2013 2:54 pm

Hi Everyone,

Since there are several possible apple ios screen sizes, I would like to find out how to determine what the height and width of the device screen size is.

This will help me to resize images, groups, etc. based on what the device is since I don't know what the user installs the app onto.

I have used this which is good for the card but I would also like to adjust the card size based on the device screen size.

Code: Select all

on preOpenStack
   set the width of group "big ben group" to the width of this cd
   set the height of group "big ben group" to the height of this cd
end preOpenStack
Thanks.

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

Re: Resizing group to match size of device screen

Post by Klaus » Sun Jan 06, 2013 3:09 pm

Hi rleiman,

check "the screenrect" in the dictionary, this will tell you width and heigth of the current screen.


Best

Klaus

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Resizing group to match size of device screen

Post by rleiman » Sun Jan 06, 2013 3:17 pm

Thanks Klaus. :D

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Resizing group to match size of device screen

Post by rleiman » Sun Jan 06, 2013 4:14 pm

screenrect worked perfectly for me.

Code: Select all

put screenrect() into theScreenSize
   
set the width of group "big ben group" to word 1 of item 3 of the field "theScreenSize" 
set the height of group "big ben group" to word 1 of item 4 of the field "theScreenSize" 
Is there a way to scale the image inside the group to match this size? I don't care if the aspect ratio is off. I wish to fill the entire group with the image.

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Resizing group to match size of device screen

Post by rleiman » Sun Jan 06, 2013 4:20 pm

I just realized that coding lock up the app!

The group resized nicely but I don't know what adding those lines of code lock up the app because commenting them out allows the app to run.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Resizing group to match size of device screen

Post by dunbarx » Mon Jan 07, 2013 3:37 am

Hi.

Lose the word "the" before "field". This is syntactically incorrect.

Craig Newman

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Resizing group to match size of device screen

Post by rleiman » Mon Jan 07, 2013 11:46 am

Thanks Craig,

I also found by transferring the code from preOpenStack to preOpenCard there is no lockup. :D

Post Reply