stack size

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

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

stack size

Post by Samuele » Thu Oct 14, 2021 8:56 am

hi, i am devoloping an app for mobile but i don't know what is the best size for to stack(vertical), so it doesn't seem weird in the phone, thanks
Samuele.

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 9:22 am

The dimensions of your stack should be the same as those of your target phone . . .

SO, that means that of you are targetting more than one device you have to use code
that will change the size of the stack depending on which kind of phone it ends up on.

This website will give you phone dimensions: https://www.gsmarena.com/

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 9:26 am

I'm finishing a fairly simple game for children
As Italian may not be on everyone's language list, this information would be useful in English.

[If you need to communicate with me privately, please write in English, Scots, French or Bulgarian.]

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: stack size

Post by Samuele » Thu Oct 14, 2021 9:31 am

thank you, but now i have 2 questions 1) how do i write the code that changes the stack size depending on the phone? 2)in what size livecode stacks work? (cm, mm pixels...)
thank you.
Samuele.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: stack size

Post by Samuele » Thu Oct 14, 2021 9:36 am

richmond62 wrote:
Thu Oct 14, 2021 9:26 am
I'm finishing a fairly simple game for children
As Italian may not be on everyone's language list, this information would be useful in English.

[If you need to communicate with me privately, please write in English, Scots, French or Bulgarian.]
ok, i was replying to an italian :wink:
Samuele.

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 11:04 am

That's OK, but all postings here are public, so will be read by lots of people.

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 11:06 am

LiveCode stacks are measured in pixels.

As I have NEVER made anything for mobile platform I hope
someone better qualified will answer your other questions.

However, what I do know is that one canget the screenSize for any monitor like this:

Code: Select all

put the screenRect
then you can set the WIDTH and the HEIGHT of your stack to fit.

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: stack size

Post by SparkOut » Thu Oct 14, 2021 2:58 pm

On a mobile platform there is no "windowing" and the stack ALWAYS takes up the entire available screen area. Each card ALWAYS takes the size if the stack.
You can use the effective screenrect and the working screenrect to get more detail about the dimensions you have for the actual size you need to work to. (You can't set the height or width of a card or stack on mobile.) There are a number of screen configurations on iOS devices and literally hundreds on Android.
If you plan for a typical target device, you can try the fullscreenMode setting to scale it accordingly when different devices are used. See some of the posts here by jacque to get some great info.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: stack size

Post by jmburnod » Thu Oct 14, 2021 3:11 pm

Hi All,
I have the same goal for iPad.
You may use fullscreenMode if each control doesn't move.
If some controls move, you have to set the loc of each control regarding screenrect.
Best regards
Jean-Marc
https://alternatic.ch

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 3:52 pm

That makes the whole thing back-to-front.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: stack size

Post by Samuele » Thu Oct 14, 2021 5:10 pm

tahnks , yes ,in my mobile it does fit to the screen but then it becomes a little strange because it is not enlarged proportionally, do you have any ideas how to make it fit the screen but in a way that the stack enlarges proportionally (width and height) thank you!
Samuele.

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 5:11 pm

The stack will NOT enlarge proportionally,

so you have to include code to reposition components.

As mentioned above, this is where screenRect comes into play.

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: stack size

Post by elanorb » Thu Oct 14, 2021 6:00 pm

Hi,

You might want to look at the fullScreenMode property. This lets you set the full screen scaling mode of your stack.

There is a lesson here

https://lessons.livecode.com/m/4069/l/1 ... ll-devices

I hope that helps.

Elanor
Elanor Buchanan
Software Developer
LiveCode

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: stack size

Post by elanorb » Thu Oct 14, 2021 6:03 pm

Sorry, I just noticed fullScreenMode had already been suggested!
jmburnod wrote:
Thu Oct 14, 2021 3:11 pm
Hi All,
I have the same goal for iPad.
You may use fullscreenMode if each control doesn't move.
If some controls move, you have to set the loc of each control regarding screenrect.
Best regards
Jean-Marc
The lesson might still be helpful though.
Elanor Buchanan
Software Developer
LiveCode

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

Re: stack size

Post by richmond62 » Thu Oct 14, 2021 6:26 pm

This is how I manage things in the very rare occasions I need to resize stacks:
-
SShot 2021-10-14 at 20.22.27.png
-
Yes, it is extremely childish!

But when the stack is resized all the buttons, fields and pictures move to where they should be.

Everything is in the stackScript:

Code: Select all

on preOpenStack
   set the width of stack "ScreenSizer" to 500
   set the height of stack "ScreenSizer" to 400
   set the loc of btn "get SCREENSIZE" to 250, 50
   set the loc of img "monster" to 250, 200
   set the loc of fld "ff" to 250, 345
   set the loc of img "z1" to 29, 48
   set the loc of img "z2" to 29, 351
   set the loc of img "z3" to 470, 48
   set the loc of img "z4" to 470, 351
   set theloc of img "guff" to 250,15
end preOpenStack

on resizeStack nWIDD, nHITE, oWIDD, pHITE
   set the loc of btn "get SCREENSIZE" to (nWIDD / 2), 50
   set the loc of img "monster" to (nWIDD / 2), (nHITE / 2)
   set the loc of fld "ff" to (nWIDD / 2), (nHITE - 55)
   set the loc of img "z1" to 29, 48
   set the loc of img "z2" to 29, (nHITE - 49)
   set the loc of img "z3" to (nWIDD - 30), 48
   set the loc of img "z4" to (nWIDD - 30), (nHITE - 49)
   set the loc of img "guff" to (nWIDD / 2), 15
end resizeStack
Attachments
ScreenSizer.livecode.zip
Here's the stack.
(49.58 KiB) Downloaded 114 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”