Page 1 of 1

Sizing problem on test device

Posted: Mon Feb 04, 2013 10:56 am
by ilpojGAMNPSN
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 :?:

Re: Sizing problem on test device

Posted: Mon Feb 04, 2013 6:34 pm
by Klaus
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

Re: Sizing problem on test device

Posted: Tue Feb 05, 2013 2:25 am
by Mag
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.

Re: Sizing problem on test device

Posted: Fri Feb 08, 2013 10:54 pm
by ilpojGAMNPSN
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.

Re: Sizing problem on test device

Posted: Thu May 02, 2013 10:31 am
by Fasasoftware
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

Re: Sizing problem on test device

Posted: Tue May 14, 2013 9:47 pm
by leston12
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?

Re: Sizing problem on test device

Posted: Sun May 19, 2013 3:01 am
by Mag
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