keyboardActivated question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
keyboardActivated question
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?
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?
Re: keyboardActivated question
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
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
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Re: keyboardActivated question
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.
Re: keyboardActivated question
Have you tried moving it with Animation engine, that is pretty smooth.
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Re: keyboardActivated question
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.
Oh, as an aside - exit keyboardDeactivated does not work, ie it's not recognized.
Re: keyboardActivated question
Well, instead of the exit you could check to see if your fields dont have focus and if so then move the form back.