Moving a field to make room for the iOS keyboard

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
timvos
Posts: 10
Joined: Tue Dec 13, 2011 6:49 am

Moving a field to make room for the iOS keyboard

Post by timvos » Tue Dec 27, 2011 8:26 am

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?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

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

Post by jmburnod » Tue Dec 27, 2011 10:50 am

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
https://alternatic.ch

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

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

Post by Dixie » Tue Dec 27, 2011 12:45 pm

Jean-Marc...

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

Happy Xmas

Dixie
Attachments
kboard.livecode.zip
(1.5 KiB) Downloaded 336 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

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

Post by jmburnod » Tue Dec 27, 2011 1:01 pm

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
https://alternatic.ch

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

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

Post by Dixie » Tue Dec 27, 2011 1:35 pm

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

timvos
Posts: 10
Joined: Tue Dec 13, 2011 6:49 am

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

Post by timvos » Tue Dec 27, 2011 6:30 pm

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.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

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

Post by jmburnod » Tue Dec 27, 2011 7:23 pm

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
https://alternatic.ch

Post Reply