Native field with focus and no keyboard

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Native field with focus and no keyboard

Post by simon.schvartzman » Tue Mar 02, 2021 8:18 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Native field with focus and no keyboard

Post by richmond62 » Tue Mar 02, 2021 8:24 pm

to hide the keyboard
Presumably you mean the virtual keyboard on either an Android or a iOS device.

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Tue Mar 02, 2021 8:38 pm

Presumably you mean the virtual keyboard on either an Android or a iOS device.
Yes, sorry for not being clear enough.
Simon
________________________________________
To ";" or not to ";" that is the question

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Native field with focus and no keyboard

Post by richmond62 » Tue Mar 02, 2021 8:47 pm

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)

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Tue Mar 02, 2021 10:03 pm

Thanks Richmont, unfortunatly not joy...

Still betting that someone will know how to do it.

Regards
Simon
________________________________________
To ";" or not to ";" that is the question

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Native field with focus and no keyboard

Post by kdjanz » Tue Mar 02, 2021 11:14 pm

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.

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Wed Mar 03, 2021 1:21 pm

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.
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Native field with focus and no keyboard

Post by jacque » Wed Mar 03, 2021 8:00 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Wed Mar 03, 2021 9:15 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Native field with focus and no keyboard

Post by jacque » Wed Mar 03, 2021 10:45 pm

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?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Thu Mar 04, 2021 12:53 pm

@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
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Native field with focus and no keyboard

Post by jacque » Thu Mar 04, 2021 7:36 pm

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.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Native field with focus and no keyboard

Post by simon.schvartzman » Thu Mar 04, 2021 7:55 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Native field with focus and no keyboard

Post by jacque » Thu Mar 04, 2021 9:45 pm

In your report, ask if the team has any suggestions. I can't think of a workaround for now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Talking LiveCode”