Page 1 of 1

EFFECTIVE WORKING SCREENRECT doesnt work with FullScreenMode

Posted: Sat Dec 20, 2014 3:53 am
by William Jamieson
Why doesn't effective working screenrect or most of the screenrect type functions on mobile work when the fullscreenmode is set?

I feel that Livecode is suppose to make developing on multiple screens easy, so why is it that I am continually having to find out how livecode works to just be able to do simple actions that ideally take one line of code.

By looking at the forums, I noticed that a lot of people are having trouble with finding a way to find the top edge of the mobile keyboard. Maybe I am wrong and there is a simple solution. Please someone tell me that there is a simple solution to this. If not I have created a solution that kind of works within (+/-) a few pixels.

Here is the solution I created:

Code: Select all

constant tBuffer = 2 --I did this just to seal up any line that happened to be showing
on KeyboardActivated
put round((item 4 of the effective working screenrect) * (the height of me) / (item 4 of the screenrect - item 2 of the effective working screenrect) - item 2 of the effective working screenrect) + tBuffer into tScreenBottom
set the bottom of grp "MyGroup" of this card to tScreenBottom
end KeyboardActivated
This works for most devices, but will be a few pixels off on some devices

I feel that built into the FullScreenMode functionality should be a way for the LC engine to translate the pixels of the screen to the pixels of the stack because they are much different

I just feel frustrated because Livecode creates one of the best tools ever! Then has one simple and most needed feature that doesn't work. Why go 95% of the way to making it usable and then stop??

How do you feel about this?

-Will

Re: EFFECTIVE WORKING SCREENRECT doesnt work with FullScreen

Posted: Sat Dec 20, 2014 9:40 pm
by jacque
I feel that built into the FullScreenMode functionality should be a way for the LC engine to translate the pixels of the screen to the pixels of the stack because they are much different
There are functions to determine the pixel scale of the device (mobilePixelDensity and pixelScale) which affect how screen calculations work. By default, in order to retain backward compatibility, LC will returns most coordinates using "logical" points, as though there was no pixel differentiation. However, it transparently uses real pixels when drawing to screen so that high-density screens will render correctly. See especially "pixelScale" in the dictionary, and follow up on all the "see also" entries: systemPixelScale Property, usePixelScaling Property, screenPixelScale Property, screenPixelScales Property.

The effective working screenrect should also return "logical" coordinates. If you haven't changed the default pixelScale, you should be able to use those normally and let LC manage the screen positions. If you really do want to know the actual pixel values, set the usePixelScaling to false. Note that the dictionary says that this will only work on iOS, as Android doesn't have an equivalent system scaling mechanism. But experiment, since I've not used this much. I just let LC handle it.

Re: EFFECTIVE WORKING SCREENRECT doesnt work with FullScreen

Posted: Sun Dec 21, 2014 4:24 am
by William Jamieson
Yeah that is about how far my research brought me. I saw those in the dictionary and began experimenting with each of those functions, but they didn't lead me anywhere. I kept getting returned values of 1 and 2 for the pixel scaling on Android which gives its multiplication ratio (doubling the size of my stack). Which is true, but before it does that, it scales the stack in a much more slight way to make it more proportional to the screen using "showAll" or "exactFit"

If you have any solutions using those functions, im all ears because I haven't been able to get anything to work better than the equation listed above. Haven't tried it on iOS. That may be different since I know that Runrev favors iOS much more even though Kevin has an android :o lol (JK there is much more money there. Its just easier to test and develop with Android.)

Has anyone else tried to reverse engineer the pixelscaling with fullscreenmode? I would be surprised if not one person on these forums doesn't need fullscreenmode and a keyboard... I'm starting to question what I am doing...

Re: EFFECTIVE WORKING SCREENRECT doesnt work with FullScreen

Posted: Sun Dec 21, 2014 9:42 pm
by jacque
I looked at this and I think it's a bug. The effective working screenrect was specifically added to the language to do exactly what you want, and in my tests it always returns the same invalid rect regardless of the fullscreenmode setting. I think you should report it: http://quality.runrev.com

Re: EFFECTIVE WORKING SCREENRECT doesnt work with FullScreen

Posted: Mon Dec 22, 2014 6:21 pm
by William Jamieson
I'll add it to the list of things I need to report...