keyboardDeactivated oddity...

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

keyboardDeactivated oddity...

Post by paulsr » Sun Jan 06, 2013 9:24 am

Greetings:

I have an iPad screen which has text entry fields in the lower half of the screen.

I found a forum post which suggested using on the 'on keyboardActivated' handler to move the text areas to the top of the screen when the keyboard was present in the lower half.

This works quite nicely, except...

It's possible to tap the screen between the text entry fields, and this seems to fire the 'on keyboardDeactivated' handler. My code moves my text fields back to the lower half of the screen ... *BUT* the keyboard remains.

When I tap the bottom right key to remove the keyboard, the 'on keyboardDeactivated' handler fires a second time.

For me, this is a bit messy, because I have other fields in the top half which I fade out and move off-screen before moving the other text fields to the top. And then I move the top fields back and fade them in once the other fields have been moved to the bottom. So, when the keyboardDeactivated handler fires the second time, my top fields fade out and in.

I'm guessing there's no way to know the keyboard is on-screen, as opposed to activated?

TIA

--paul

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: keyboardDeactivated oddity...

Post by Dixie » Sun Jan 06, 2013 12:14 pm

Post your code...

Dixie

scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

Re: keyboardDeactivated oddity...

Post by scotttyang » Tue Jan 08, 2013 12:22 am

I built the fields for text entry to be above the keyboard line, just to avoid this type of situation.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: keyboardDeactivated oddity...

Post by Simon » Tue Jan 08, 2013 3:49 am

Hi Paul,
I see why Dixie was so blunt.
Seems to me in your 'on keyboardDeactivated' handler you added some code to fix the problem of switching between fields throwing a false 'on keyboardDeactivated' which it does here.
Now just testing with two fields on a card, tapping outside a text fld takes the focus away from the field and the keyboard goes away. UNLESS you are tapping on an non focusable object (e.g. image)(i.e. no keyboardDeactivated message). Maybe the answer for you is to place an image behind the fields.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: keyboardDeactivated oddity...

Post by paulsr » Sat Jan 12, 2013 4:54 am

Thanks for all the comments.

I didn't post my code because there's a lot of it, and I really should take the time to strip it down to see why I am getting this odd keyboard behavior. But, to be honest, this isn't really a major issue for me... I just find it strange.

My question really was in my last line:

I'm guessing there's no way to know the keyboard is on-screen, as opposed to activated?

...and I'm still guessing the answer is 'no'.

Simon: Yes, maybe an image behind the fields is a workaround. Thanks for that.

--paul

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: keyboardDeactivated oddity...

Post by Simon » Mon Jan 14, 2013 11:36 pm

Paul,
You are correct, with the few tests I made, currently you can get many false triggers thrown.

It is almost true that if a editable text field has focus then the keyboard is up, until the soft keyboard down key is hit. :x

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply