Page 1 of 2
Handling the pop-up keyboard...
Posted: Tue Mar 25, 2014 7:33 am
by paulsr
Greetings:
In my iOS apps, whenever I have fields which require data-entry, I place them in the top-half of the screen. That way, when the keyboard pops-up, the fields are not hidden.
But with Android, it seems, when the keyboard pops-up, the screen moves up with it, thus hiding the data-entry fields.
At the moment, the only solution I can think if, is to re-arrange the fields if the platform is android, so that they are in the bottom half of the screen, and therefore remain visible when the keyboard appears.
I'm thinking there must be a more elegant solution.
I've tried things like:
Code: Select all
on keyboardActivated
set the rect of this stack to the effective working screenRect
end keyboardActivated
But this seems to override the resolution independence feature of LC.
I have set the rect of the stack to 0,0,768,1024 and I'm using...
Code: Select all
set the fullscreenmode of this stack to "letterbox"
I'm testing with a Moto G Android phone, which has a resolution of 720x1280, but when the keyboard pops-up, LC reports the effective screenRect as 0,25,360,570 and what remains visible is a much-magnified part of my stack.
Bottom line is: I'm a bit lost. Is there a nice way to handle the keyboard pop-ups, such that the data-entry field is visible?
Many thanks...
--paul
Re: Handling the pop-up keyboard...
Posted: Fri Jan 09, 2015 5:19 pm
by JacobS
Hi Paul,
I know that this was posted ~10 months ago, but the keyboard pushes the screen up on Android devices if the "acceleratedRendering" property of the stack is set to true. If you do not set this property (or set it to false) then the keyboard won't move the screen when it pops up.
Hope that helps,
Jacob
Re: Handling the pop-up keyboard...
Posted: Sat Jan 10, 2015 2:52 am
by paulsr
Many thanks Jacob.
Fortunately I managed to get the solution from another forum, so everything is now working as expected.
--paul
Re: Handling the pop-up keyboard...
Posted: Fri Jun 26, 2015 3:33 pm
by sphere
Please Paul, tell me where ?
Thanks
Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 5:04 am
by paulsr
I meant to imply that the response from JacobS was the one I needed, but that I had also found it somewhere else.
--paul
Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 11:40 am
by sphere
Ah yes,
ok thanks Paul.
I'm playing with setting it true or false, i don't see many differences on my android. But more having a problem to get rid of the keyboard.
already tried some focus things to focus somewhere else when pushing somewhere on the screen, seems not always to work correct.
Then the keyboard disappers but the screen still stays shifted up, after a fews taps on the screen it shifts normal again. so that's a bit annoying for users.
Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 11:49 am
by paulsr
Yes, it's very annoying. And it needs a lot of trial and error.
Tomorrow I'll try to find (and post) the code that worked for me.
--paul
Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 12:09 pm
by sphere
Would be great.
Hope i can use it

Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 3:03 pm
by FourthWorld
This may help:
Move a native mobile text input control so it is not covered by keyboard
http://lessons.runrev.com/m/4069/l/1367 ... y-keyboard
Re: Handling the pop-up keyboard...
Posted: Sat Jun 27, 2015 4:05 pm
by sphere
Yes i tried that.
I have to figure out the rect, i've not looked into it yet how it works.
But i implemented it in my code(without changing the rect, so that's stupid of course)
But did not see anything happen at all.
(and if you turn the example into apk without changing something the whole screen is covered gray

)
So have to take a closer look on how to implement it because that would be neat if you tap on an input field that a nice square field would pop up with some bigger charachters
so you can see what your typing on a tiny screen
Re: Handling the pop-up keyboard...
Posted: Sun Jun 28, 2015 8:26 am
by paulsr
Well; I've looked at my code, and the only thing I can see that I had to do was to add:
Code: Select all
set the acceleratedRendering of this stack to false
in the preOpenCard
And I even added a comment to remind myself why that line was there.
So, probably not too helpful.
--paul
Re: Handling the pop-up keyboard...
Posted: Sun Jun 28, 2015 9:37 am
by sphere
ok thanks Paul.
I will try that, because sometimes the display view sometimes stays shifted up while the actual button is already at the original place shifted down, but you can't see, but you can tap on the button where it original belonged. Can you still follow?
So hopefully this will help.
Re: Handling the pop-up keyboard...
Posted: Sun Jun 28, 2015 12:16 pm
by paulsr
sphere wrote:Can you still follow?
Kinda! I seem to recall I had the same problem, and that one line of code cured everything. Good luck.
--paul
.
Re: Handling the pop-up keyboard...
Posted: Sun Jul 19, 2015 3:51 pm
by sphere
Hi Paul,
found in another thread this solution which works perfectly.
(
http://forums.livecode.com/viewtopic.php?f=7&t=23730 at the last reply)
Code: Select all
on keyboardDeactivated
focus on nothing
set the vScroll of this stack to 0
end keyboardDeactivated
put it in the card script
Re: Handling the pop-up keyboard...
Posted: Mon Jul 20, 2015 2:12 am
by paulsr
Okay tkx. I'll give it a try...
--paul