fitting to screen size

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ajperks
Posts: 103
Joined: Sat Sep 06, 2014 3:38 pm

fitting to screen size

Post by ajperks » Wed Jul 25, 2018 8:18 pm

I tried to scale a stack but it seemed to remain at 1.0 even though I tried 0.3
How do you cater for different sizes?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: fitting to screen size

Post by richmond62 » Wed Jul 25, 2018 9:25 pm

Well?

1. To size a stack to take up a whole screen is easy
(although people may get a bit miffed about your covering start bars and so on):

Code: Select all

on openStack
put item 3 of the screenRect into WW
   put item 4 of the screenRect into HH
   set the width of this stack to WW
   set the height of this stack to HH
   set the topleft of this stack to 0,0
   end openStack
2. To resize a stack and preserve the positions of the objects on the stack means
messing around with the GEOMETRY MANAGER
which, personally, I would not go near with a 10 foot pole.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: fitting to screen size

Post by richmond62 » Wed Jul 25, 2018 9:29 pm

If you wish to resize a stack in another way than using screenRect then you can do this sort of thing:

Code: Select all

on mouseUp
set the width of this stack to 400
set the height of this stack to 600
end mouseUp
OR, if you want to be "a bit more clever" do something like this:

Code: Select all

on mouseUp
put the width of this stack into WW
put the height of this stack into HH
put (HH * 0.3) into HH
put (WW * 0.3) into WW
set the width of this stack to WW
set the height of this stack to HH
end mouseUp

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: fitting to screen size

Post by quailcreek » Thu Jul 26, 2018 4:07 am

If you're writing a mobile app try this.
Also look up fullscreenmode in the dictionary.

Code: Select all

on preOpenStack
  if environment() is not "mobile" then exit to top
  
  set the fullscreenmode of this stack to "exactFit"
end preOpenStack
Tom
MacBook Pro OS Mojave 10.14

ajperks
Posts: 103
Joined: Sat Sep 06, 2014 3:38 pm

Re: fitting to screen size

Post by ajperks » Thu Jul 26, 2018 7:33 am

Thank you both for the excellent help. I will be exploring the scripts and read up the code in the dictionary.

I did a search here about screen sizing, before I posed my question and it did not look promising. I was not keen on spending lots of time hunting for an answer that did not exist, so asking for help proved to be the best solution.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: fitting to screen size

Post by FourthWorld » Thu Jul 26, 2018 3:37 pm

The stack will automatically fill the screen, and LC's resolution independence generally allows us to never have to think about pixel density except in very specialized cases.

Can you tell us more about the problem you're trying to solve?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: fitting to screen size

Post by richmond62 » Thu Jul 26, 2018 5:20 pm

The stack will automatically fill the screen
You might be jumping to conclusions as ajperks has not
stated whether s/he is programming for desktop computers or handheld devices.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: fitting to screen size

Post by Klaus » Thu Jul 26, 2018 5:22 pm

richmond62 wrote:
Thu Jul 26, 2018 5:20 pm
You might be jumping to conclusions as ajperks has not
stated whether s/he is programming for desktop computers or handheld devices.
Since this is the ANDROID forum, I think we can presume this without problems. :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: fitting to screen size

Post by jacque » Thu Jul 26, 2018 5:56 pm

Also, when using fullscreenmode, try all the different mode options. Some will work better than others depending on the stack layout. I usually find showAll or noBorder to work best on mobile.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: fitting to screen size

Post by richmond62 » Thu Jul 26, 2018 6:23 pm

Since this is the ANDROID forum
No doubt . . .

BUT as I saw it in the "New posts" section . . . 8)

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: fitting to screen size

Post by Klaus » Thu Jul 26, 2018 6:31 pm

Well, obviously some people can type faster than they can think... :D

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: fitting to screen size

Post by FourthWorld » Thu Jul 26, 2018 6:51 pm

richmond62 wrote:
Thu Jul 26, 2018 6:23 pm
Since this is the ANDROID forum
No doubt . . .

BUT as I saw it in the "New posts" section . . . 8)
"New Posts" is a query result, not a section. I'm not chastising, just sharing my own journey here: As a daily user of "New Posts", I've lost track of the number of times I've responded to posts here with inappropriate guidance because I hadn't checked the section they were posted in. I try to do that more often now.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: fitting to screen size

Post by richmond62 » Thu Jul 26, 2018 7:21 pm

just sharing my own journey here
Erm, Yes, Well . . . about the time I walked into a public toilet and then realised
the picture on the door did NOT represent a man in a kilt.

We can play this sort of game for ages. :D

ajperks
Posts: 103
Joined: Sat Sep 06, 2014 3:38 pm

Re: fitting to screen size

Post by ajperks » Fri Jul 27, 2018 12:09 pm

I have had chance to try some scripts as suggested above.

Also I need to clarify what I am doing, why I am doing it and what on.
I am attempting to fit a fixed card size, designed for a specific desktop monitor/screen to a smartphone. The resulting program can then be tested to see what works and what doesn't. I can set about reorganising the interface if the features of the program work. The fact the image will be small and distorted beyond reason, is not a concern. Neither is the fact that desktop buttons rather than smartphone style controls are used. They actually work well, from what is visible so far.
Once I find what works, I can create a new program that interfaces properly.
I am developing an android app for smartphones and tablets (Not apple) that also has a desktop interface. The Phone/tablet component is for viewing and interacting, like you might with a Facebook App, but the desktop component provides the design and creation of data that is not practical on a small screen, touch device.

OK, The Rectangle method works well for the stack, but I cannot resize the card the same way, so this is not a complete solution.
The fullscreenmode and options does not work at all, for me. It stays in the same location and size as the stack is saved in. Dictionary does not explain why it fails. No solution here.

I had placed the card content into a group with scroll bars, so with a smaller stack than card, I should be able to navigate around it. I am not able to get this to work either, but don't concern yourself with this.

Any more ideas?

ajperks
Posts: 103
Joined: Sat Sep 06, 2014 3:38 pm

Re: fitting to screen size

Post by ajperks » Fri Jul 27, 2018 3:26 pm

I have tried other things, but scalefactor of stack seems to work perfectly for a set ratio.
I used a table field to form a grid so I could see what cells (sizing device) covered the screen area and then with a button and field to hold a variable, I could experiment. Yes, I know a table field could contain the scale value, but the cells are to small to put a value in, physically.
Thank you all for your help and advice. I can come back to it if I need to refine things.

on mouseup
answer fld "grid1"
set scalefactor of stack "GridSize" to fld "grid1"
end mouseup

Post Reply

Return to “Android Deployment”