Length is what I want to trigger on so that no extra buttons have to be pushed before or after the scan.
The scanner acts like a keyboard, just no enter key.
I haven’t found the right place to add the check for length.
I’m assuming it has to be in the onMasternum event.
I currently have an additional button event and then do all my checks on that button press. That’s the button press I’m trying to avoid when using scanner, I.e. test that length is 12.
local function onMasternum( event )
print("In onMasternum")
if ( "began" == event.phase ) then
masternumField.text=""
hidekbButton.alpha=1.0
elseif ( "ended" == event.phase ) then
masternumField:setTextColor( 51, 51, 122, 255 )
native.setKeyboardFocus( nil )
hidekbButton.alpha=0
elseif ( "submitted" == event.phase ) then
masternumField:setTextColor( 51, 51, 122, 255 )
native.setKeyboardFocus( nil )
hidekbButton.alpha=0
end
end
masternumField = native.newTextField( 50, viewrow+70, 220, 36, onMasternum )
masternumField.font = native.newFont( native.systemFontBold, 24 )
masternumField.text = "MasterNumber"
masternumField:setTextColor( 51, 51, 122, 45 )
masternumField.inputType = "number"
Edit: Got it. Added another ‘if’ to check for length. Didn’t think I could do that but seems so 
[import]uid: 6547 topic_id: 21561 reply_id: 85446[/import]