iOS soft keyboard microphone key

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
creepyTowel
Posts: 14
Joined: Sat Nov 12, 2011 4:53 pm

iOS soft keyboard microphone key

Post by creepyTowel » Sun May 26, 2013 5:43 pm

Does anyone know if it's possible to get the "microphone" key on the soft keyboard to enter text into a field successfully?

I only ever get the first letter of whatever I speak placed into the selected field whenever I press it.

Thanks!

Peter.

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

Re: iOS soft keyboard microphone key

Post by JacobS » Tue May 28, 2013 4:00 pm

Hi Peter,

If you use the LiveCode text field then the microphone only enters the first letter of what you speak. If you want to use the microphone and the other "iOS shortcut" keystrokes like "omw" automatically updates to "on my way" then you have to use an iOSNativeControl.

For an app that I've made, I used the inputControl called "multiline" but there's a single-line input of type "input" that you can also use.
This tutorial is really really helpful:
http://lessons.runrev.com/s/lessons/m/4 ... ols-on-ios

If you can't get it working from that tutorial, this is the code that I used to create a field for comments in my app:

Code: Select all

on preOpenCard
   if the environment is not "mobile" then exit preOpenCard
   inputCreate
end preOpenCard

on inputCreate
   if "testinput" is among the lines of iphoneControls() then
      inputDelete
   end if   
   iphoneControlCreate "multiline", "testinput"
   iphoneControlSet "testinput", "rect", the rect of fld "comment"
   iphoneControlSet "testinput", "visible", true
   updateFieldProps
   iphoneControlSet "testinput", "text", the text of fld "comment"
   inputFocus
end inputCreate

on inputFocus
   iphoneControlDo "testinput", "focus"
end inputFocus

on updateFieldProps
   iphoneControlSet "testinput", "fontSize", 16
   iphoneControlSet "testinput", "textColor", "black"
   iphoneControlSet "testinput", "borderStyle", none
   iphoneControlSet "testinput", "textAlign", "left"
   iphoneControlSet "testinput", "autoCapitalizationType", none
   iphoneControlSet "testinput", "keyboardType", "default"
   iphoneControlSet "testinput", "contentType", "plain"
end updateFieldProps

on closeCard
   inputDelete
end closeCard

on inputDelete
   if the environment is not "mobile" then exit inputDelete
   iphoneControlDelete "testinput"
end inputDelete
Hope that helps. The crucial part is that you have to use a native iOS control in order to use the microphone properly on the device.

Jacob

creepyTowel
Posts: 14
Joined: Sat Nov 12, 2011 4:53 pm

Re: iOS soft keyboard microphone key

Post by creepyTowel » Wed May 29, 2013 1:12 pm

Thanks a million Jacob. That's got me off to a great start.

Peter.

Post Reply