fullscreenmode and rect of a substack on mobile device ?

Sannyasin Brahmanathaswami brahma at hindu.org
Thu Aug 23 13:42:15 EDT 2018


This thread will never finish (hehe)

I am still have trouble getting  the two object in the stack in place when we open stack on mobile.

The resize handlers wrok, and soon as we rotate the phone and back and geometry is implemented.

But not on open stack..

So I use your script. I was not orienting the stack size against the screenrect first.

Still not go:

on preopenstack

if isMobile() then

mobileSetAllowedOrientations "portrait,portrait upside down,landscape left,landscape right"

setupStackRect

end if

end preopenstack

----------------------

# Geometry

on orientationChanged

-- setupStackRect

end orientationChanged

on setupStackRect pWidth,pHeight

if pWidth="" and pHeight="" then

put the effective working screenRect into tRect

set the rect of this stack to tRect

set the topLeft of this stack to item 1 to 2 of tRect

else

put the rect of this stack into tRect

put tWidth into item 3 of tRect

put tHeight into item 4 of tRect

set the rect of this stack to tRect

end if

set bottom of group "footer" to item 4 of tRect

set loc group "footer" to ( (item 2 of tRect)/2,(item 4 of tRect)/25 )

subtract 50 from item 4 of tRect

set the rect of widget "body" to tRect

end setupStackRect

on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight

# check it is landscape, turn off the navigation Bar

if pNewWidth > pNewHeight then -- landscape

put 0, 0, pNewWidth, pNewHeight into tBrowserRect

set loc widget "body" to (pNewWidth/2,pNewHeight/2)

hide group "footer"

else

put 0, 0, pNewWidth, pNewHeight - 50 into tBrowserRect

set loc group "footer" to (pNewWidth/2,pNewHeight-25)

show group "footer"

end if

set the rect of widget "body" of me to tBrowserRect

end resizeStack



On 8/23/18 2:21 AM, FlexibleLearning.com via use-livecode wrote:

Coming in late to the thread, but would this not work on all platforms?

on preOpenStack
  setupStackRect
end preOpenStack

on orientationChanged
  --  setupStackRect
end orientationChanged

on setupStackRect pWidth,pHeight
  if pWidth="" and pHeight="" then
    put the effective working screenRect into tRect
    set the rect of this stack to tRect
    set the topLeft of this stack to item 1 to 2 of tRect
  else
    put the rect of this stack into tRect
    put tWidth into item 3 of tRect
    put tHeight into item 4 of tRect
    set the rect of this stack to tRect
  end if
end setupStackRect

You would obviously need to handle individual control geometry as needed,
but I found using a (hidden) master group of template graphics to define
regions a straightforward way to implement consistent geometry settings...

Set [the geometry] of [object] to [the geometry] of [graphic]
e.g. set the topleft of fld "About" to the topLeft of grc "template_Body"




More information about the use-livecode mailing list