Page 1 of 1

iOS soft keyboard microphone key

Posted: Sun May 26, 2013 5:43 pm
by creepyTowel
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.

Re: iOS soft keyboard microphone key

Posted: Tue May 28, 2013 4:00 pm
by JacobS
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

Re: iOS soft keyboard microphone key

Posted: Wed May 29, 2013 1:12 pm
by creepyTowel
Thanks a million Jacob. That's got me off to a great start.

Peter.