keyboardActivated question

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

keyboardActivated question

Post by richardmac » Fri Jan 21, 2011 5:39 am

Our app is almost to the beta point. I'm getting very fired up! This has been a lot of fun.

Here is my situation. We have a group with two fields in it and it covers most of the screen, and when a user touches a field, that sends a keyboardActivated message to the card. So in the card script I put something like this:

on keyboardActivated
-- change the location of the group to move it higher on the screen
end keyboardActivated

on keyboardDeactivated
-- change the location of the group back to it's original location
end keyboardDeactivated

This works awesome - the whole group slides up and the keyboard slides up, so the user can see the field they're typing in. There's just one problem. The user touches the first field and everything slides like it should, but WHILE the keyboard is on the screen if they touch the second field to move focus to it, it sends "keyboardDeactivated" and the keyboard goes away. Is there a better way to do this?

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: keyboardActivated question

Post by andyh1234 » Fri Jan 21, 2011 7:24 pm

Could you use something like...

on keyboardDeactivated
if the focusedObject contains "fieldx" then exit keyboardDeactivated
-- scroll back code
end keyboardDeactivated

That way you could check if either field has still got the focus and prevent your interface sliding back.

Andy

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: keyboardActivated question

Post by richardmac » Fri Jan 21, 2011 11:54 pm

Well... we're having to abandon the idea, because the animation of moving the group is fine on the simulator, but it's awful on the actual hardware. I was moving the group around using a repeat loop and setting the loc of the group - works great on Mac and on simulator and dreadful on the actual iPad. So back to the drawing board.

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: keyboardActivated question

Post by andyh1234 » Fri Jan 21, 2011 11:57 pm

Have you tried moving it with Animation engine, that is pretty smooth.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: keyboardActivated question

Post by richardmac » Sat Jan 22, 2011 12:54 am

I don't own it, but I might look into it. Not sure about everything it can do - I'll have to read up on it.

Oh, as an aside - exit keyboardDeactivated does not work, ie it's not recognized.

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: keyboardActivated question

Post by andyh1234 » Sat Jan 22, 2011 1:44 am

Well, instead of the exit you could check to see if your fields dont have focus and if so then move the form back.

Post Reply