Page 1 of 2

fitting to screen size

Posted: Wed Jul 25, 2018 8:18 pm
by ajperks
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?

Re: fitting to screen size

Posted: Wed Jul 25, 2018 9:25 pm
by richmond62
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.

Re: fitting to screen size

Posted: Wed Jul 25, 2018 9:29 pm
by richmond62
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

Re: fitting to screen size

Posted: Thu Jul 26, 2018 4:07 am
by quailcreek
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

Re: fitting to screen size

Posted: Thu Jul 26, 2018 7:33 am
by ajperks
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.

Re: fitting to screen size

Posted: Thu Jul 26, 2018 3:37 pm
by FourthWorld
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?

Re: fitting to screen size

Posted: Thu Jul 26, 2018 5:20 pm
by richmond62
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.

Re: fitting to screen size

Posted: Thu Jul 26, 2018 5:22 pm
by Klaus
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

Re: fitting to screen size

Posted: Thu Jul 26, 2018 5:56 pm
by jacque
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.

Re: fitting to screen size

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

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

Re: fitting to screen size

Posted: Thu Jul 26, 2018 6:31 pm
by Klaus
Well, obviously some people can type faster than they can think... :D

Re: fitting to screen size

Posted: Thu Jul 26, 2018 6:51 pm
by FourthWorld
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.

Re: fitting to screen size

Posted: Thu Jul 26, 2018 7:21 pm
by richmond62
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

Re: fitting to screen size

Posted: Fri Jul 27, 2018 12:09 pm
by ajperks
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?

Re: fitting to screen size

Posted: Fri Jul 27, 2018 3:26 pm
by ajperks
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