Thank you robmiracle for your quick reply. I wrote a test as follows:
local ui = require(“ui”)
io.output():setvbuf(‘no’)
local function fieldHandler( event )
if ( “began” == event.phase ) then
– This is the “keyboard has appeared” event
– In some cases you may want to adjust the interface when the keyboard appears.
elseif ( “ended” == event.phase ) then
– This event is called when the user stops editing a field: for example, when they touch a different field
elseif ( “submitted” == event.phase ) then
– This event occurs when the user presses the “return” key (if available) on the onscreen keyboard
print (“Hiding the keyboard”)
– Hide keyboard
native.setKeyboardFocus( nil )
local outText = display.newText(defaultField.text,0,0,native.systemFontBold,14)
outText:setTextColor(170, 170, 255, 255)
outText:setReferencePoint(display.CenterLeftReferencePoint)
outText.x = 10
outText.y = 200
fields:insert(outText)
print(“defualtField.text = [” …defaultField.text… “]”)
end
end
local defaultField, numberField, phoneField, urlField, emailField, passwordField
local fields = display.newGroup()
local inputFontSize = 18
local inputFontHeight = 30
defaultField = native.newTextField( 10, 30, 180, 30, fieldHandler )
defaultField.font = native.newFont( native.systemFontBold, inputFontSize )
– Add fields to our new group
fields:insert(defaultField)
local defaultLabel = display.newText( “Default”, 200, 35, native.systemFont, 18 )
defaultLabel:setTextColor( 170, 170, 255, 255 )
– Determine if running on Corona Simulator
local isSimulator = “simulator” == system.getInfo(“environment”)
– Native Text Fields not supported on Simulator
if isSimulator then
msg = display.newText( “Native Text Fields not supported on Simulator!”, 0, 280, “Verdana-Bold”, 12 )
msg.x = display.contentWidth/2 – center title
msg:setTextColor( 255,255,0 )
end
I run the app on the device and enter “Test” in the newTextField.
My output is limited to a message on the console being printed
Hiding the keyboard
The keyboard does hide, but I do not get anything else. I should get text on the screen and a printout on the console, but I do not.
Am I missing something? I just need to get the text [import]uid: 36999 topic_id: 13037 reply_id: 47891[/import]