App Programming‎ > ‎

Sizing

Sizing Your App to the Screen (monitor, mobile screen, etc)
With most languages, you have to program for each screen size that is different. 


1. Mobile Devices - cellphones, tablets, etc

Cellphones are a little different. You do not have to worry about the user resizing the window or screen. But you do have to accomodate all the different cellphone screens and resolutions. With so many different phones out there,often developers just do it for a few phones - the ones most commonly sold.

LiveCode has a special command that automatically sets the window size to the screen size.

To use it, add the following code to your stack.

        on preOpenStack 
            if the environment is "mobile" then 
                    set the fullscreenmode of me to "exactFit" 
                    set the acceleratedrendering of me to true 
            end if 
        end preOpenStack

2. Desktop Computers with Monitors
On desktops, users can resize windows and you have to have code that resizes each screen object (buttons, graphics, etc) to expand or shring as the window that it is in changes.

LiveCode has Geometry properties that makes this easy.

In the "Property Inspector" for each object on the screen, go to "Geometry"  There are 2 sizing choices - "Scale..." and "Position..."
The "scale..." is for graphics that you want to stretch or shrink with the window as the user changes it.
The "Position..." is to have buttons and other objects to move with the side and bottom of the window so that they always stay in view on the screen. You can lock them in a number of ways (see the red wavy lines which could also be solid red lines - experiment with both to see which works best for your app) 

                                                                           




Comments