how to properly use the fullscreenmode and screen scaling

Sannyasin Brahmanathaswami brahma at hindu.org
Sun Oct 28 21:06:29 EDT 2018


On 10/27/18 11:40 AM, Mike for GDC via use-livecode wrote:
> I am new to LC and have learned much so far but I am having an issue with
> the proper scaling of my app on different size screens.  I have created the
> app with the dimensions of 913 w X 636 h.  All looks great on the desktop.

I've spent 2 years on "this subject" and, like Jacque says

The "showAll" fullscreenMode ensures that the full height of the stack 
contents are visible on screen. This means on narrower screens, 
left/right edges may be cropped and on wider screens there may be an 
extra margin."

So we that for complex layout, but for simple layout, but if you want to do you own geometry, I finally got working across  numerous Android devices, just yesterday! 

Disclaimer: there more this that meets the eye. But we have a hack and works.

You see, Android doesn't know the screenRect until *after* it rendered a card. No amount of preopenstack or openstack will work. 

What works is (Andre, God bless him, figured this out:) wait until one card is rendered for doing any geometry

Note, the "wait with messages" are important in Android, can't tell you why, but eliminate then and you get crashes

-- Stack
   card 1 - "loader"
   card 2 - your main app or module 

-- Card 1 "loader" script
   openCard
	wait 80 milliseconds with messages
	go next card
   end openCard

-- card 2 "main module (app)"

on opencard
    # you must give the device to "register" the coords!
    send "updateUI" to this card in 100 milliseconds
end opencard

on resizeStack
   updateUI
end resizeStack

command updateUI 
    put the long id of widget "body" of card "SivaSivaBrowser" into tBrowser
   put the rect of card "SivaSivaBrowser" into sCardRect #store in local
Variable for later
   put item 3 of sCardRect into tWidth
   put item 4 of sCardRect into tHeight
   put the loc of card "SivaSivaBrowser" into tCardLoc
   set the loc of widget "spinner"  of card "SivaSivaBrowser" to  tCardLoc
   set the loc of fld "Cancel"  of card "SivaSivaBrowser" to (item 1 of
tCardLoc, item 2 of tCardLoc+200)
   put (0,0,tWidth,(tHeight - 50)) into tBrowserRect
   set the rect of tBrowser  to tBrowserRect
   set loc group "footer" of card "SivaSivaBrowser" to (
round(tWidth/2),tHeight - 25)

  

# there four widgets on the footer

    put tWidth/4 into tUnit

  set the loc of widget "go-home-portal" of card "SivaSivaBrowser" to
(tUnit/2,tHeight-25)
   set the loc of widget "add-favorites" of card "SivaSivaBrowser" to
(tUnit*1.5,tHeight-25)
   set the loc of widget "share"  of card "SivaSivaBrowser" to
(tUnit*2.5,tHeight-25)
   set the loc of widget "settings-gear" of card "SivaSivaBrowser" to
(tUnit*3.5,tHeight-25)
end updateUI

# works on portrait and landscape: on Oreo, Nougat, 2 Pixels, all
different screen sizes.

Of course are only <10 controls to deal with.

   


       






More information about the use-livecode mailing list