how to get keyboard with Done or Send button?

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, robinmiller, kevinmiller, malte, splash21

Post Reply
Colin Holgate
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9
Joined: Sun Jan 08, 2012 8:59 pm

how to get keyboard with Done or Send button?

Post by Colin Holgate » Sun Jan 08, 2012 9:18 pm

How do you close a keyboard that is sat on top of a multiline MobGUI native textfield, if it doesn't have a Done or Send button? Trapping for Return won't help, because the user may be typing several lines of text.

pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: how to get keyboard with Done or Send button?

Post by pthirkell » Sun Jan 08, 2012 10:41 pm

Hopefully there is a more elegant solution ... but for now I create a "Finish" button that appears when the keyboard is activated, and which hides the keyboard by removing focus as suggested in an earlier posting.

1. Add a MOBGui button (which I call "FinishButton") that positions somewhere close to the multiline MobGUI native textfield, as shown in attached screen snippet.

2. In the button script add two lines to mouse up handler:
on mouseUp
if the environment = "development" then touchEnd 1
focus on nothing
hide me

end mouseUp

3. In the card script add this handler:
on keyboardActivated
show group "FinishButton"
end keyboardActivated

4. Deselect the "FinishButton" 'visible' property in the property inspector so that it doesn't initially appear when the card opens (or else hide it via script when the card opens).

Hopefully all works well!
Attachments
MobGUI_finish_eg.jpg

Colin Holgate
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9
Joined: Sun Jan 08, 2012 8:59 pm

Re: how to get keyboard with Done or Send button?

Post by Colin Holgate » Sun Jan 08, 2012 11:05 pm

Thanks, good to know there isn't a way to get one of those other keyboard types, that I was missing.

For my purposes I can get away with putting a "focus on nothing" in the background image, hopefully people would intuitively touch outside of the fields in order to deselect them. I have a Go button that is at the top of the screen, so the user can make the next step happen, the problem case is if they want to not "go", but instead immediately want to jump to another screen, the keyboard is sat on top of the tab bar.

pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: how to get keyboard with Done or Send button?

Post by pthirkell » Mon Jan 09, 2012 10:36 am

Hmmm ... maybe place a 'Cancel' button as well up the top near the 'Go' button? That would clear the keyboard and free up the tab bar for the user to jump elsewhere.

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: how to get keyboard with Done or Send button?

Post by Nakia » Mon Mar 26, 2012 3:20 am

You could change the iOS return key to "done" which when pressed can hide the keyboard..

ronbird
Posts: 17
Joined: Wed Sep 18, 2013 9:27 am

Re: how to get keyboard with Done or Send button?

Post by ronbird » Wed Mar 11, 2015 12:02 pm

on a very similar subject but in Android.
I've poped the keyboard:

on opencard
--
focus on fld "Field3"
if environment() = "mobile" then
mobileSetKeyboardType "phone"
end if
--
end openCard

but I want the keyboard to say "OK" where the return arrow appears.
Any suggestions guys?
Thanks Ron

Post Reply

Return to “MobGUI”