Page 1 of 1

Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 8:18 pm
by simon.schvartzman
Hi smartpeople, there is probably an obvious way to do it but I can't find it...

I have a native input field, with focus, waiting for a barcode scanner to place its reading on it.

The problem is: I would like to hide the keyboard since the input data is to come from the barcode scanner only.

How can this be acomplished?

As always, many thanks in advance

Re: Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 8:24 pm
by richmond62
to hide the keyboard
Presumably you mean the virtual keyboard on either an Android or a iOS device.

Re: Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 8:38 pm
by simon.schvartzman
Presumably you mean the virtual keyboard on either an Android or a iOS device.
Yes, sorry for not being clear enough.

Re: Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 8:47 pm
by richmond62
LiveCode doesn't like me:

Code: Select all

on mouseUp
   set the keyboardActivated to false
end mouseUp
But this might work:

Code: Select all

on mouseUp
   set the keyboardType of fld "fff" to empty
end mouseUp
WARNING: I have never made anything for Android or iOS and 100% don't know what I'm talking about:
merely pissing around with what I found in the Documentation by typing 'keyboard'. 8)

Re: Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 10:03 pm
by simon.schvartzman
Thanks Richmont, unfortunatly not joy...

Still betting that someone will know how to do it.

Regards

Re: Native field with focus and no keyboard

Posted: Tue Mar 02, 2021 11:14 pm
by kdjanz
I don’t do Android, but I seem to remember seeing on the forums something like

Code: Select all

Focus on nothing
To deactivate the field and make the keyboard disappear.

Only a vague memory but hope it helps.

Re: Native field with focus and no keyboard

Posted: Wed Mar 03, 2021 1:21 pm
by simon.schvartzman
Thanks @kdjanz.

Your memory is good: focus on nothing will hide the keyboard but will also take the focus out from the field and I need the focus to remain on it in order to receive the scanner data.

Re: Native field with focus and no keyboard

Posted: Wed Mar 03, 2021 8:00 pm
by jacque
Try setting the editable of the field to false. This apparently only works for multiline fields but you can make it show only one line by adjusting the height.

Code: Select all

mobileControlSet tControl, "editable", false 
But if the field is just for display I don't think you need a native field at all. You could just use a locked LC field, unless you need the clipboard actions.

Re: Native field with focus and no keyboard

Posted: Wed Mar 03, 2021 9:15 pm
by simon.schvartzman
Hi Jacque, thanks for your suggestion
Try setting the editable of the field to false
The scanner needs the field to have focus in order to be able to receive the data being captured. With editable being false then no reading is captured...
But if the field is just for display I don't think you need a native field at all
The field is not just for display, it has to receive the data that is read by the scanner

What I actually need is the equivalent to "Focus with Keyboard = False" for a native field...

The next question would be why do I have to use a native field instead of a "regular" one to receive the scanner input. I don't know the answer but the fact is the scanner works OK with a native field and just the first digit is captured when a "regular" field is used...but this should be the subject of another post

Re: Native field with focus and no keyboard

Posted: Wed Mar 03, 2021 10:45 pm
by jacque
simon.schvartzman wrote:
Wed Mar 03, 2021 9:15 pm
The next question would be why do I have to use a native field instead of a "regular" one to receive the scanner input. I don't know the answer but the fact is the scanner works OK with a native field and just the first digit is captured when a "regular" field is used...but this should be the subject of another post
Okay, that's very strange. I was going to suggest, as a test, a LC field with both traveralOn and locktext set to true but if LC fields don't work then neither will my idea. I can't test since I don't have the necessary hardware, but years and years ago (before mobile was available) I made an app that captured bar code scans and LC fields received the entire data. The client is still using the app and it still works; last compile was with LC 9.0 I believe.

There may be a way to force a LC field to receive all the data, maybe it's a timing issue or similar. If I recall, I was using keyUp to capture the data since the scanner sent the characters as key presses. Is that how your hardware works?

Re: Native field with focus and no keyboard

Posted: Thu Mar 04, 2021 12:53 pm
by simon.schvartzman
@Jacque see remarks below
...but years and years ago (before mobile was available) I made an app that captured bar code scans...
inspired by the above I tested an App (with just a LC field) on Mac (Mojave) with and guess what? It worked fine, the whole code was read as expected.
Then I decided to test on the iPhone simulator ( iOS 13.3) and it works as well.
So it doesn't work just on Android (6.0) unfortunatly the only device I have available for testing
I was using keyUp to capture the data since the scanner sent the characters as key presses. Is that how your hardware works?
Handling keyUp is not needed on Mac but if I do like below, then each character is shown twice (same on iPhone)

Code: Select all

on keyUp pKeyName
   put pKeyName after field "barcode"
end keyUp
the same code on Android just shows the first character two times as well.

I guess this is a bug and I will report it as such on the Quality board

Re: Native field with focus and no keyboard

Posted: Thu Mar 04, 2021 7:36 pm
by jacque
I probably remembered wrong. Try keyDown instead. That should eliminate the double characters.

But the Android issue does sound like a bug (assuming keyDown still fails.)

Re: Native field with focus and no keyboard

Posted: Thu Mar 04, 2021 7:55 pm
by simon.schvartzman
Jacque, uour memory is OK, I saw an old post from you about the subject where you mention keyUp.
Anyway as I said above LC "regular" fields works OK on Mac without the need of keyUp or KeyDown.

I've opened a bug report regarding Android behaviour.

Will see. Meanwhile I will need to cope with Native Field and Keyboard being shown.

Thanks for all

Re: Native field with focus and no keyboard

Posted: Thu Mar 04, 2021 9:45 pm
by jacque
In your report, ask if the team has any suggestions. I can't think of a workaround for now.