The Android screenrect

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 412
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

The Android screenrect

Post by andyh1234 » Tue May 05, 2020 2:27 pm

Is there a way to get the effective / working screen rect for Android devices.

Ive tried the screenrect, the working screenrect and the effective screenrect but all return the same result, the screen rect including the status and navigation bars.

I would like to know the actual area available for my app, the space between the two bars.

The reason is as follows. The livecode scaling options are brilliant, but the exactFit option (and others) are not perfect when you design for a ratio of 1.77 and then deploy on a 2/1 screen. It is simple enough, however, to resize the stack before setting the exactfit property, you get the benefit of the scaling on 95% of controls on the card and just have to reposition the bottom items or group that controls the scrolling element, there is no distortion this way.

The issue is I cannot seem to find out how to get the ratio after the menu bars have been taken into account. I don't want to hide the bars, I just want to resize the size of my stack to use the available space before setting the exactfit option to scale everything so circles stay as circles etc.

Using anything I've tried includes the whole screen, even if I've asked for the working screenrect.

Its just small things like this that are stopping me using Livecode for a full app.

Any ideas would be very welcome!

andyh1234
Posts: 412
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Re: The Android screenrect

Post by andyh1234 » Tue May 05, 2020 2:48 pm

Please ignore this.

I was just using the last two numbers in the screenrect, the working screenrect does return the numbers I need in all four values returned, I just had to take off the 24 it returned in the second result from the last to get the working screenheight I wanted.

Now I have the working screen height, and know I design the stack to 667x375, I can work out the multiplier and set the height of the stack appropriately, then set the fullscreenmode to exact fit and the app scales perfectly, with circles staying as circles. I then just reposition the base bar and resize my scrolling group and everything just scales up, its lovely!

Sorry for asking a stupid question, I hope this answer helps someone else in my position with the same question.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8424
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: The Android screenrect

Post by FourthWorld » Tue May 05, 2020 3:40 pm

What happens when you run the app on a screen with a different ratio?

For a very clear test case for that which is easy to check, how does it look when you rotate the device?
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

andyh1234
Posts: 412
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Re: The Android screenrect

Post by andyh1234 » Wed May 06, 2020 6:21 pm

Yes, it all works now, thanks. Ive set up a few simulators with different screen ratios and it works perfectly.

Todays challenge was to get the group on the page to extend down to the bottom of the newly sized stack and have that have a scroller, it was surprisingly easy with some of the examples here on the forum.

I design for 1.77/1 and then use code to get the screen ratio, that was what I was struggling with to get the ratio right.

I then use code to change the height of the stack when it loads if the ratio is different (eg 2/1) and also adjust the height of the 'main' scrolling group before adding the mobile scrolling code and it all just works, Livecode takes care of all the scaling and because the stack is the same ratio as the screen there is no distortion, everything is nice and crisp.

Post Reply

Return to “Android Deployment”