Native control, hidding keyboard

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Native control, hidding keyboard

Postby bangkok » Tue Nov 08, 2016 2:36 pm

I've got an Android (5.1) device with a barcode scanner (integrated).

Works fine.

I would like to hide the keyboard, when the focus is set on a native control.

Or to say it differently : is it possible to have a field that will receive the characters sent by the barcode scanner, without displaying the virtual keyboard ?
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby bangkok » Tue Nov 08, 2016 6:03 pm

Actually I have noticed that if I touch long enough on a native control (input)... the insertion cursor appears, there is focus, the content sent by the barcode scanner is displayed, but the keyboard doesn't show up.

So it's a progress !
;-)


Is there is a way to "emulate" this kind of long "mousedown" ? I could send the message, with an opencard for instance.

The native control would always keep the focus, but without the virtual keyboard.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby FourthWorld » Tue Nov 08, 2016 9:10 pm

If the field is not to be used by the user to edit directly, does it need to be a native editable field?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 5192
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles

Re: Native control, hidding keyboard

Postby bangkok » Wed Nov 09, 2016 9:54 am

FourthWorld wrote:If the field is not to be used by the user to edit directly, does it need to be a native editable field?


Yeah, I could use a regular livecode field instead.... but the behavior with the "long click" is different than with native control : the keyboard always shows up.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby jacque » Wed Nov 09, 2016 6:40 pm

If the field is only for display, is there a reason not to use a locked LC field? Locked fields don't trigger the keyboard.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3597
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Native control, hidding keyboard

Postby bangkok » Thu Nov 10, 2016 2:53 pm

jacque wrote:If the field is only for display, is there a reason not to use a locked LC field? Locked fields don't trigger the keyboard.


To summarize my conundrum

-if i use native control input
When i long touch the control, insertion point comes, keyboard doesn't show up : that's good
but when the focus is lost (if i display an answer dialog for instance), I need to long touch AGAIN to have insertion point back.
-> the command mobileControlDo "xxxx", "focus" doesn't work on Android

-if i use a regular livecode text field
Whenever the field gets the focus, with insertion point, the virtual keyboard is showing up. that's bad.

So I guess, the solution would be to have a command to force the focus on a native control input (it means to get the insertion point)

Or to programmatically emulate the "long touch" on a regular livecode text field.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby jacque » Thu Nov 10, 2016 5:35 pm

It would be helpful to know why you need an insertion point without the keyboard. If it just to designate where incoming text should go, that can be done in the script.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3597
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Native control, hidding keyboard

Postby bangkok » Thu Nov 10, 2016 6:13 pm

jacque wrote:It would be helpful to know why you need an insertion point without the keyboard. If it just to designate where incoming text should go, that can be done in the script.


Text is coming from the barcode reader, integrated to my android device.

It works the same way as a regular barcode scanner that you plug with on USB port to a PC : it emulates a "keyboard".

So on my Android device, I need a native control input, with focus, or a regular livecode field, in order to "catch" the text sent by the barcode reader.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby jacque » Thu Nov 10, 2016 6:25 pm

Just a guess but try this:

Code: Select all
on keyUp pKey
  put pKey after fld "barcode"
end keyUp
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3597
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Native control, hidding keyboard

Postby bangkok » Tue Nov 15, 2016 9:44 am

jacque wrote:Just a guess but try this:

Code: Select all
on keyUp pKey
  put pKey after fld "barcode"
end keyUp


Unfortunately, if there isn't any focus (on a regular field or a native input control), KeyUp or KeyDown messages are not fired when the barcode scanner reads data.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby bangkok » Thu Nov 17, 2016 11:36 am

OK i found a solution with regular livecode field

By using a... ask command !

Code: Select all
on opencard
select the text of field "barcode" ---- the virtual keyboard shows up
ask "Ready to work ?" ---- the virtual keyboard goes off
select the text of field "barcode" ---- the insertion point comes, ready to received scanned data, the virtual keyboard doesn't show up again
end opencard


This behavior would probably be seen as a bug.

I'm using LiveCode 8.1.1 with Android 5.1 device (tested on Android 4.1.1 device as well)

But right now, it solves my problem. :)
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby jacque » Thu Nov 17, 2016 5:03 pm

Did you try putting the keyUp handler in the card script? Keypress messages will go there if no field has focus.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3597
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Native control, hidding keyboard

Postby bangkok » Thu Nov 17, 2016 9:58 pm

jacque wrote:Did you try putting the keyUp handler in the card script? Keypress messages will go there if no field has focus.


I did.

Actually, if there is no focus (no insertion point in a field or a native input control), the characters sent by the barcode reader do not fire up the keyUp message.

Same issue with the "hard" keyboard (my android device has a small numerical keyboard too).

At least, this is the behavior is see with LiveCode 8.1 and 8.1.1 Indy on Android 5.1.

By the way, it might interest some readers. Here is the device I use : OCBS-D8000 :

http://www.ocominc.com/products/2014-Ne ... D8000.html

We use this device for inventory and other applications. Connected via wifi to a MySQL server... and sending queries to a Odoo server ! Smooth.

I bought a few, from this company (in Hong Kong), via their website on Alibaba. 350 USD each. Fast delivery. No problem.
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 766
Joined: Fri Aug 15, 2008 7:15 am

Re: Native control, hidding keyboard

Postby jacque » Fri Nov 18, 2016 1:00 am

That's a twist I didn't know, though it makes sense I guess that a mobile device wouldn't always be listening for keystrokes. On desktop, at least, the traversalOn property determines whether a field can get focus. I wonder what would happen if you tinker with turning it on and off. It's a long shot I admit. I'm thinking there has to be some way around the problem but like you, I can't think of it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3597
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Native control, hidding keyboard

Postby pr1de » Tue Mar 21, 2017 1:11 am

Dear Fellas,

Can someone give me a mighty hand of help, otherwise i'm just gonna kill meself. I can't make the bloody thing to check if "field" is not empty then delete everything and do keyDown. It empties the field but doesn't do any input whatsoever.
local tCard
local tFieldText
Code: Select all
on KeyDown theKey
   if field "Barcodes" is not empty then
      put empty into fld "Barcodes"
      pass KeyDown
      put theKey after fld "Barcodes"
      put fld "Barcodes" into tFieldText
      put "A" & tFieldText into tCard
      go to card tCard
   else
      pass KeyDown
      put theKey after fld "Barcodes"
      put fld "Barcodes" into tFieldText
      put "A" & tFieldText into tCard
      go to card tCard
   end if
end KeyDown


However, if I run this code it works perfectly!
Code: Select all
on KeyDown theKey
      put theKey after fld "Barcodes"
      put fld "Barcodes" into tFieldText
      put "A" & tFieldText into tCard
      go to card tCard
end KeyDown

Thank you
pr1de
 
Posts: 3
Joined: Sat Sep 03, 2016 6:27 pm

Next

Return to Android Deployment

Who is online

Users browsing this forum: No registered users and 1 guest