Handling the pop-up keyboard...

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Handling the pop-up keyboard...

Post by paulsr » Tue Mar 25, 2014 7:33 am

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

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

Re: Handling the pop-up keyboard...

Post by JacobS » Fri Jan 09, 2015 5:19 pm

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

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Sat Jan 10, 2015 2:52 am

Many thanks Jacob.

Fortunately I managed to get the solution from another forum, so everything is now working as expected.

--paul

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Fri Jun 26, 2015 3:33 pm

Please Paul, tell me where ?

Thanks

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Sat Jun 27, 2015 5:04 am

I meant to imply that the response from JacobS was the one I needed, but that I had also found it somewhere else.

--paul

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Sat Jun 27, 2015 11:40 am

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.

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Sat Jun 27, 2015 11:49 am

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

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Sat Jun 27, 2015 12:09 pm

Would be great.
Hope i can use it :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Handling the pop-up keyboard...

Post by FourthWorld » Sat Jun 27, 2015 3:03 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Sat Jun 27, 2015 4:05 pm

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 :oops: :mrgreen: )

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

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Sun Jun 28, 2015 8:26 am

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

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Sun Jun 28, 2015 9:37 am

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.

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Sun Jun 28, 2015 12:16 pm

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

.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Handling the pop-up keyboard...

Post by sphere » Sun Jul 19, 2015 3:51 pm

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

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling the pop-up keyboard...

Post by paulsr » Mon Jul 20, 2015 2:12 am

Okay tkx. I'll give it a try...

--paul

Post Reply