Sizing problem on test device

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ilpojGAMNPSN
Posts: 3
Joined: Sat Sep 01, 2012 4:29 pm

Sizing problem on test device

Post by ilpojGAMNPSN » Mon Feb 04, 2013 10:56 am

Greetings all fellow dabblers in the awesome art of LiveCode :)

I've been building my first application for months now.
It will be deployed for android mobile devices.

The stack and it's graphics are made to 1280x720 resolution (which Galaxy S3 has).
Using the geometry manager, I've made the whole app fully scalable (at least in windows desktop).

I have the android SDK:s installed, and the testing on a virtual device works with Android 2.3.3.
But the virtual device has only a smaller resolution of 800×480, and on starting the app, on the
device, it won't automatically shrink to fit the screen, but stays in it's original
resolution, going way behind the screen edges.

Now, I also tried to resize the stack to 800x400 (seems to work perfectly in windows), save it, and then run the test, but
because the original graphics are bigger, they stay the same size as in the first example.

Is there a way to code the stack so, that it
first checks the size of the mobile device's screen resolution, and then resizes the stack, before laying it out,
or do the geometry manager's scale options only work in Windows desktop :?:

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

Re: Sizing problem on test device

Post by Klaus » Mon Feb 04, 2013 6:34 pm

Hi ilpojGAMNPSN,

welcome to the forum! :D
ilpojGAMNPSN wrote:...Is there a way to code the stack so, that it first checks the size of the mobile device's screen resolution, and then resizes the stack, before laying it out, ...
yes, do this on "preopenstack":
...
set the rect of this stack to the screenrect
## et voila :D
## now do your layout...
...
ilpojGAMNPSN wrote:...or do the geometry manager's scale options only work in Windows desktop :?:
No idea, since I never used the geometry manager.

Best

Klaus

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Sizing problem on test device

Post by Mag » Tue Feb 05, 2013 2:25 am

ilpojGAMNPSN wrote:Now, I also tried to resize the stack to 800x400 (seems to work perfectly in windows), save it, and then run the test, but
because the original graphics are bigger, they stay the same size as in the first example.

Is there a way to code the stack so, that it
first checks the size of the mobile device's screen resolution, and then resizes the stack, before laying it out,
or do the geometry manager's scale options only work in Windows desktop :?:
I don't know so much of the geometry manager, anyway could be a problem related with the original images size.

Maybe the geometry manager resizes the controls but not the images (e.g. the button but not the images you use as the icon of the button). If the problem is this, you can implement some script that resize the images, I had a problem about this and post my experience here: http://forums.runrev.com/viewtopic.php?f=49&t=13729

If this is not the problem, I hope some other person of the forum can help you better.

ilpojGAMNPSN
Posts: 3
Joined: Sat Sep 01, 2012 4:29 pm

Re: Sizing problem on test device

Post by ilpojGAMNPSN » Fri Feb 08, 2013 10:54 pm

Thanks Klaus and Mag for the answers :D

I got the graphic's resizing working on the the test device, by writing the resizing code manually. First copy-pasting from the "task manager" lessons, and then adjusting.

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: Sizing problem on test device

Post by Fasasoftware » Thu May 02, 2013 10:31 am

Dear friend.....use this code...

Code: Select all

on mouseUp
   put the height of this stack into tHeight
   put the width of this stack into tWidth
   put "on resizeStack" & cr & "put the height of this stack into tHeight" & cr & "put the width of this stack into tWidth" & cr into tResize
   repeat with i = 1 to the number of controls of this cd
      put the long id of control i into tName
      if tName = the long id of me then next repeat
      put wordOffset("stack",tName) into tWord
      put word 1 to (tWord -2) of tName into tName
      put the rect of control i into tSize
      put round(item 1 of tSize / tWidth,3) into tLeft
      put round(item 2 of tSize /tHeight,3) into tTop
      put round(item 3 of tSize / tWidth,3) into tRight
      put round(item 4 of tSize / tHeight,3) into tBottom
      put "set the rect of" && tName && "to" && "round(" & tLeft & "* tWidth)" & comma & "round(" & tTop & "* tHeight)" & comma & \
            "round(" & tRight & "* tWidth)" & comma & "round(" & tBottom & "* tHeight)" & cr after tResize
   end repeat
   put "end resizeStack" after tResize
   set the clipboardData["text"] to tResize
   answer information "The script has been copied to the clipboard, paste it into the stack script" titled "Now paste it"
end mouseUp
This is a script that automate the size of screen and controls in real time.....

1) copy this script put it into a button on yor card that have control
2) push button
3)paste script generated in automatic to the main stack script
4) add also:

Code: Select all

on openstack
resizestack
end openstack
that's all!!!
cheers...
Lestroso :D

leston12
Posts: 25
Joined: Thu Mar 28, 2013 8:25 pm

Re: Sizing problem on test device

Post by leston12 » Tue May 14, 2013 9:47 pm

Thank you for sharing your code, it is very helpful for scaling controls.
I need to scale field controls, as well as the size of the text in the fields.

When I used metacard years ago there were textoverflow/textunderflow properties of a field that were helpful in determining how the text fits into the field size. I don't see these properties in LC now, however. Is there something similar in LC?

If not, any suggestions for how to scale fonts sizes?
Leston

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Sizing problem on test device

Post by Mag » Sun May 19, 2013 3:01 am

leston12 wrote:Thank you for sharing your code, it is very helpful for scaling controls.
I need to scale field controls, as well as the size of the text in the fields.

When I used metacard years ago there were textoverflow/textunderflow properties of a field that were helpful in determining how the text fits into the field size. I don't see these properties in LC now, however. Is there something similar in LC?

If not, any suggestions for how to scale fonts sizes?
Just set the textSize of control to X

PS
Remember that you don't need to resize groups

Post Reply