Page 1 of 1

Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 8:26 am
by timvos
I'm trying to move a field to a new location when the iOS keyboard activates. This is what I have in mind:

Code: Select all

on mouseUp --in field "search"
   set location of field "search" to (172,14)
end mouseUp

on keyboardDeactivated
   set location of field "search" to (172,160)
end keyboardDeactivated
Unfortunately, this code does not work. Can anyone tell me what will work instead?

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 10:50 am
by jmburnod
Hi timvos,

It seem the keyboardDeactived don't work.
You can use this script to set the loc of the field when is selected or not

Code: Select all

on openfield
   set the top of the target to 14
end openfield


on closefield -- work only if the content has been changed
   set the top of the target to 72
end closefield

on exitfield -- work if the user leaves a field  if the content hasn't been changed
   set the top of the target to 72
end exitfield
Best regards

Jean-Marc

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 12:45 pm
by Dixie
Jean-Marc...

The keyboard commands do work... :D
See attached stack...

Happy Xmas

Dixie

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 1:01 pm
by jmburnod
Hi Dixie,
The keyboard commands do work...
Yes with your stack but why

Code: Select all

on keyboardDeactived
   answer "keyboardDeactived" with "OK"
end keyboardDeactived

on keyboardActived
  answer "keyboardActived" with "OK"
end keyboardActived
don't work ?

All the best

Jean-Marc

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 1:35 pm
by Dixie
Jean-Marc...

Your problem is with your spelling...
You have scripted 'on keyboardDeactived' and 'keyboardActived'.... it should be 'keyboardDeactivated' and 'keyboardActivated'
It's that strange 'English' language that has tripped you up...

be well

Dixie

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 6:30 pm
by timvos
Thanks, Jean-Marc, your code worked like a charm.

Thank you, too, Dixie. I had coded my 'on keyboardDeactivated' as an object script attached to the field. I gather from your script that the code needs to be attached to the card instead.

Re: Moving a field to make room for the iOS keyboard

Posted: Tue Dec 27, 2011 7:23 pm
by jmburnod
Hi Dixie,

Sorry for this and thank for your reply (to much screen hours for an old man with old eyes)

Be well to

Jean-Marc