John

Yes, use a native input control (see page 70 of the 6.0 iOS release notes). 
When the user taps in the control the keyboard shows (or you can have it show 
when the control is initially created or made visible). You can specify that 
your keyboard has a "Done" key - hitting that will hide the keyboard and you 
can also trap for that (using inputReturnKey) and do whatever you need to with 
the contents of the control.

This creates a control (this is for a control that is used in a search feature):

local searchInputID

on showSearch
  if "searchinput" is not in iphoneControls()  then
    iphoneControlCreate "input","searchinput"
    put the result into searchInputID
    iphoneControlSet searchInputID, "rect", the rect of btn "shadowfield"
    iphoneControlSet searchInputID, "textcolor", "gray"
    iphoneControlSet searchInputID, "autofit", "true"
    iphoneControlSet searchInputID, "autoclear", "true"
    iphoneControlSet searchInputID, "clearButtonMode", "always"
    iphoneControlSet searchInputID, "borderstyle", "rounded"
    iphoneControlSet searchInputID, "autoCorrectionType", "yes"
    iphoneControlSet searchInputID, "enabled", "true"
    iphoneControlSet searchInputID, "returnKeyType", "search"
    iphoneControlSet searchInputID, "keyboardType", "search"
    iphoneControlSet searchInputID, "visible", "true"
    iphoneControlSet searchInputID, "text", "Search"
  end if        
end showsearch

Here's how you trap for the return (or "done" key):

on inputReturnKey
  if iphonecontroltarget() = "searchinput" then
    put iphoneControlGet (searchInputID, "text") into seachString -- or put it 
into a field in your case
    searchFor seachString -- or just store the text in a field  
  end if
end inputReturnKey

You can even do stuff when the use first focuses on the control:

on inputBeginEditing
  if iphonecontroltarget() = "searchinput" then
    iphoneControlSet searchInputID, "textcolor", "black"
  end if
end inputBeginEditing

Hope that helps.


Gerry

On 15/04/2013, at 8:13 AM, JOHN PATTEN <johnpat...@me.com> wrote:

> Is this possible, or is there a reasonably accepted practice for entering 
> text into fields in a LiveCode iOS app?

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to