Resize Stack Sent Everytime a Stack Opens?

Sannyasin Brahmanathaswami brahma at hindu.org
Mon May 13 10:59:33 EDT 2019


Brain Wrote

What fullScreenMode are you in when the stack opens?  What mode when the rotation happens?
===============
BR 
I am trying to do dynamic geometry. Trying to deal with iPhone X  (height) as well as 9 X 18 Android (my Moto6) 
--"fullScreenMode" interferes with your own handlers/function. Most of my screens have only a footer (task bar) and 1-5 other controls. Laying this out should not be too hard. (so I thought)

Having little experience (most I do you "fullScreenMode") I was starting close to ground zero. See:

See: http://wiki.hindu.org/uploads/rotation-test_r6.livecode

If you can improve on this, please do! Send me a copy

My initial test are keeping it simple. I have a browser and a footer that I want to keep occupy the whole screen on any device/screenrect (the "notch" is a nuisance, be leaving that for later nuances....) and changes easily from portrait to landscape layout and back again  (with crashing Andriod...)  Using the least amount of code as possible.

The last time I worked on this intensively was circa 9.0.1 stable. I run this stack in 9.0.1 stable, I get big differences. In 9.0.4 (rc3) I have determined so far that..

NOTE: I am not trying Ralph code which he sent to me a long time ago and which in may need to trying again. But it did not work for me at the time. I am also testing to make sure that HQ get really gets it right. (sending bug reports)(

What I learned the past few days -- disclaimer some of these may be false assumptions, or "expected" results, or are real bugs

1) You cannot get the coordinates of anything on start up or opencard. Andre discovered that we can you use a "loader" card, (card  1)  that "goes next" in 80 milliseconds (arbitrary) to the next card, *then* the engine has coordinates (card size, screenrect)

2) The resizestack in not firing automatically in many cases. There is difference between Android and iOS. If it does, we get nothing in. x,y. You can use handler like this send "resizeStack" && the width of this stack & comma & \
               the height of this stack to me in 0 milliseconds.  

But this is no different the one that does had it own name.

    send "update" && the width of this stack & comma & \
               the height of this stack to me in 0 milliseconds

3) using the send 'command' [params] in 0 millisecond is now causing problems.  

4) if you get the card width and height after orientationChanged. Just put then in you handler

command updateUI theOrientation 
   lock screen
   # get coords now after changes to screen
   put the width  of this card into x
   put the height of this card into y
   put x into sCdWidth
   put y into sCdHeight
   
5) But, major caveat, returning for "face up" or to "unknown" has the consequence of swapping the x,y values.

We get 

Portrait
Card rect: 0,0,648,360     
	# on my Moto6 Android or
0,0,812,375. 
	# iOS XR

Landscape
0,0,360,648
0,0,375,812

After several days wrestling  with these caveats I woke up one morning with "algorithm"

case (theOrientation contains "face up") 
case (theOrientation contains "unknown")  
         exit to top
         break
case (theOrientation contains "portrait"  AND x >y)  
         swapWidthHeight x, y
case (theOrientation contains "portrait")
	[snip]
case (theOrientation contains "landscape"  AND y>x)  
         swapWidthHeight x, y
case (theOrientation contains "landscape")
	[snip]

command swapWidthHeight x, y
   put y into sCdWidth
   put x into sCdHeight
end swapWidthHeight

now it works
6) But... an android  a case where 

card rect 
0,0,360,649

Screen rect 
0,0,360,672
# 24 point too long!
 
And, I turn the phone form  landscape to portrait, my footer is 24 pixels below screen. I have to "flick" the phone forward and back again, my update handler runs again and the foot appears again in the right place.

Does anyone know about the 24 pixel difference between the cardrect and the screenrect on Android?
Is there a way to "refresh" after going to landscape to portrait?

BR

PS The dictionary looks transparent but it is baffling once you read it. 

" The orientationChanged message is sent before any automatic interface
rotation takes place thus changes to the orientation lock state and
allowed set can be made at this point and still have an effect."

Need editing to make it clear to "newbies" 

using of resizeStack  # does fire automatically
and 
<send|send in 0
milliseconds(command)> command.
#  doing this create anomalous results.

"If you wish to perform an action after the interface has been rotated, then
either do so on receipt of resizeStack, or by using a <send|send in 0
milliseconds(command)> command."







  




More information about the use-livecode mailing list