Hide the iOS keyboard

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Hide the iOS keyboard

Post by FireWorx » Mon Dec 26, 2011 7:32 pm

Hi,
I set up a user input field in iOS and have a button that takes care gathering the input and taking care of business. Hitting the return key does the same and then hides the keyboard. My question is what code takes care of hiding the keyboard if the user chooses my button rather than the return key on the keyboard?
Thanks,
Dave

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

Re: Hide the iOS keyboard

Post by Dixie » Mon Dec 26, 2011 9:14 pm

Dave...

put

Code: Select all

on mouseUp
   focus on nothing
end mouseUp
in the script of your button... the keyboard will be deactivated

be well

Dixie

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Hide the iOS keyboard

Post by FireWorx » Wed Dec 28, 2011 2:09 am

Wow... Like deep meditation. Focus on nothing. Like it. Thanks!

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Wed Jan 18, 2017 12:06 pm

Hi All,
Is there a way to hide the ios keyboard definitively because I use a custom keyboard with accentued letters which can be with blue2 switch (one or two input) ?
I played with" focus on nothing" but keyboard is shown when i click on a field
with traversalon = true.
From the doc I understand that keyboardActivated is sent to the card AFTER keyboard is shown.
I thought a type "none" for mobileSetKeyboardType, but not.
Best regards
Jean-Marc
https://alternatic.ch

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Hide the iOS keyboard

Post by [-hh] » Sun Jan 22, 2017 10:32 am

Did you already try to handle things in "focusIn"?
Just an idea.
shiftLock happens

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Sun Jan 22, 2017 11:18 am

Guten Tag Hermann,
Thanks
Did you already try to handle things in "focusIn"?
No. It seems that openfield is sent instead focusin when the target field is unlocked.
I will try a lockmessages at openfield
All the best
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Sun Jan 22, 2017 12:22 pm

I tried lockmessages at open field but nothing change, (iOS keyboard comes).
https://alternatic.ch

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

Re: Hide the iOS keyboard

Post by Dixie » Sun Jan 22, 2017 2:39 pm

Hi Jean-Marc...

You mention that you wish to use your own custom keyboard... I have sent you a stack that just uses two fields... a very poor 'custom' keyboard, that I guess if you grouped the buttons, you could slide it up and down.. :-).. but with the use of two behavious ( I have left the behaviour buttons visible for you to see the script... it acts more or less like a keyboard... the behaviours are set up in the card script...

It might work for you

Dixie.. :-)
Attachments
keytest.zip
(1.5 KiB) Downloaded 308 times
Last edited by Dixie on Sun Jan 22, 2017 3:11 pm, edited 1 time in total.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Hide the iOS keyboard

Post by [-hh] » Sun Jan 22, 2017 3:07 pm

Hi Jean-Marc and John.

That's a nice trick, 'dixie'.

I avoided mobile until now, but my childs started to 'force' me to build some apps for them. So I tried here to achieve a not-popup of the keyboard when starting to edit a field. And it works here (in the simulator) by simply catching the openField, the keyboard doesn't pop up.

Code: Select all

on openField
-- do nothing and don't pass
end openField
Am I wrong with that beginner's approach?

H.
shiftLock happens

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

Re: Hide the iOS keyboard

Post by Dixie » Sun Jan 22, 2017 3:13 pm

Hermann...

Are you wrong with your approach ?... I don't know, It did not occur to me !... :-)

Dixie

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

Re: Hide the iOS keyboard

Post by Dixie » Sun Jan 22, 2017 3:27 pm

Jean-Marc..

I just had a thought that you could also popUp an overlay on a letter.. say, by using 'a mouseStillDown' handler on a button 'E', you could then show more 'E's' with the accents on them... just like the regular iOS keyboard does.. :-)

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Sun Jan 22, 2017 5:15 pm

just like the regular iOS keyboard does..
Yes, I did one because that is what I want avoid.
I choosed to make a line of the keyboard with accented letters. First line of keyboard is used for accented letters, ponctuation and numeric keyboard.

The keyboard can be use with the mouse and with a switch with 2 inputs NextObject and ClickCurObject.
I also want put the letter into the selectedchunk and not just after last char.
This stack does words prediction while the user write.

Once I cleaned the stack I post it.

Fld script

Code: Select all

on selectionChanged
   doMajStartEndW
end selectionChanged

on openfield
   --   set the lockmessages to true --avoid ios keyboard doesn't work
   doMajStartEndW
   --set the lockmessages to false
end openfield

on closefield
   doMajStartEndW
end closefield

on exitfield
   doMajStartEndW
end exitfield

on textChanged
      --   set the lockmessages to true --avoid ios keyboard doesn't work
   defTextTC --•• prediction words
      --set the lockmessages to false
end textChanged

on mouseleave
   doMajStartEndW
end mouseleave
Cd script

Code: Select all

local sStartCurWord,sEndCurWord
--store selected chunk in locals sStartCurWord sEndCurWord
on doMajStartEndW
   if char-1 of the selectedfield <> the num of fld "fText" then 
      exit doMajStartEndW
   else
      get the selectedchunk
      put word 2 of it into sStartCurWord
      put word 4 of it into sEndCurWord  
   end if
end doMajStartEndW

on defTextTC
--••prediction words
defTextTC
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Sun Jan 22, 2017 7:43 pm

I tested on device with just this script fld

Code: Select all

on openfield
end openfield
The iOS keyboard comes.
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Tue Jan 24, 2017 11:28 pm

@ John,
Here is a keyboard with custom cursor I used. It work on iOS except the keyboard which comes at each open field
http://forums.livecode.com/viewtopic.php?f=8&t=28073
I work for a new version for one bluetooth switch with two inputs
Kind regards
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Hide the iOS keyboard

Post by jmburnod » Wed Jan 25, 2017 11:08 pm

I maybe found a way to use a locked field like an unlocked field to avoid iOS keyboard.
I use a btn as custom cursor.
That was a sweet surprise that it seems work, iOS keyboard doesn't appear :D
Attachments
keyboardLocktext.livecode.zip
(3.21 KiB) Downloaded 406 times
https://alternatic.ch

Post Reply

Return to “iOS Deployment”