fullscreenmode and rect of a substack on mobile device ?

J. Landman Gay jacque at hyperactivesw.com
Wed Aug 22 16:13:40 EDT 2018


On 8/21/18 2:11 PM, Ludovic THEBAULT via use-livecode wrote:

> But even « the rect of this cd » return the rect of the stack i created (0,0,768,1024) not the rect of the screen.
> I’ve made a test stack. It’s an « iPad » stack. Test it with iOS simulator on an iPhone device.
> https://www.dropbox.com/s/iwwm2syiqzqamtg/testsubstack2.livecode?dl=0
> 
> Click on « get the rect » and click on « Adapt » to set the rect of the background to the rect of the screen

I played with this for a while. I changed the opencard handler to a 
preOpenCard, which is when FSM is usually set. But there's something odd 
going on. When I tap the "get rect" button it says:

Rect of this stack: 170,172,938,1196
Rect of this cd: 0,0,768,1024
Screenrect: 0,0,320,480

If I use "exactfit" instead of "showAll" it does sort of work and is an 
easier way to get what you scripted. Since your app is targeted only for 
iPad, exactFit may be one of the few times it's appropriate. That said, 
it still isn't resizing to the screen even with "exactFit", and it 
should. Using "NoBorder" also gives the same results where it shouldn't.

I was able to repro your scripted solution by setting fullscreenMode to 
"noBorder" and simplifying the "adapt" script this way:

on adaptrect
   put the height of this cd into tHt
   put the width of this cd into tWd
   set the rect of this stack to 0,0,tWd,tHt -- doesn't really do that
   set the rect of grc "bkg" to 0,0,tWd,tHt
   put "Rect of bg = real rect :" & the rect of grc "bkg"  after fld "datas"
   set the top of grc "lineTop" to 0
   set the bottom of grc "lineBottom" to tHt
end adaptrect

But the stack should still fill the screen and it doesn't. Either I'm 
missing something or there's a problem with FSM.

Tested in LC 9.0.1 rc1, as it's the only version I have a compatible 
XCode for. I wonder if it's different in LC 8.x.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com





More information about the use-livecode mailing list