ASK Command Return Button means "OK"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
ASK Command Return Button means "OK"
is there any possibility to press the OK button at an ASK-Event with the ENTER Button on a mobile device?
My situation is: I have an Bluetooth-Barcode-Reader, so the App asks with an Ask-command for a barcode. I scan a barcode with the bluetooth device, and the device inserts a "RETURN" after the line of numbers automatically. But i want that the "RETURN" means "PRESS OK" and not "Go to line 2" like i press Enter in a word document.
Anyone have an idea what i mean?
THANK YOU!!
My situation is: I have an Bluetooth-Barcode-Reader, so the App asks with an Ask-command for a barcode. I scan a barcode with the bluetooth device, and the device inserts a "RETURN" after the line of numbers automatically. But i want that the "RETURN" means "PRESS OK" and not "Go to line 2" like i press Enter in a word document.
Anyone have an idea what i mean?
THANK YOU!!
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: ASK Command Return Button means "OK"
I think I understand what you are asking. Maybe post that part of your code that is setting the return char.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: ASK Command Return Button means "OK"
That's just this, where i have to set the return code?quailcreek wrote: ↑Sun Jan 14, 2018 8:50 pmI think I understand what you are asking. Maybe post that part of your code that is setting the return char.
Code: Select all
global EANTemp
on mouseUp
ask "Bitte scannen Sie den EAN Code!" //English: Please scan the barcode
put it into EANTemp
put it into field "field_EAN"
end mouseUp
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: ASK Command Return Button means "OK"
I've written a couple of scanner apps so I understand that it puts a RETURN char at the end. This is how I handle it.
Code: Select all
if the last char of EANTemp is RETURN then delete the last char of EANTemp
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: ASK Command Return Button means "OK"
The return is not thw problem, its possible to turn this last return in the properties from the scanner off.quailcreek wrote: ↑Sun Jan 14, 2018 9:26 pmI've written a couple of scanner apps so I understand that it puts a RETURN char at the end. This is how I handle it.
Code: Select all
if the last char of EANTemp is RETURN then delete the last char of EANTemp
But i want the the app understands instead of the return "press OK Button"
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: ASK Command Return Button means "OK"
Ok, so you want the return char to end the ask interaction without letting the user examine the scan data. I see. I'm not sure how to do that.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: ASK Command Return Button means "OK"
correct, that's what i want. The scan data MUST be right, because the barcode scanner enters the line of numbers. No need to examine it before returnquailcreek wrote: ↑Sun Jan 14, 2018 9:57 pmOk, so you want the return char to end the ask interaction without letting the user examine the scan data. I see. I'm not sure how to do that.
-
- VIP Livecode Opensource Backer
- Posts: 7214
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: ASK Command Return Button means "OK"
I haven't tried it, but an Answer dialog may work since it doesn't have an editable field.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: ASK Command Return Button means "OK"
Instead of a button, just put this code into the script of the field "field_EAN":
and
it will handle the number when it receives the "return" or "Enter" code from the scanner
Code: Select all
on returnInField
(put your code to process the number here)
end returnInField
Code: Select all
on enterInField
(put your code to process the number here)
end enterInField
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
-
- VIP Livecode Opensource Backer
- Posts: 7214
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: ASK Command Return Button means "OK"
From the looks of it, the script is using the built-in Ask dialog on Android, which isn't editable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: ASK Command Return Button means "OK"
But the ask is in the button. I assume that the user presses a button to select if they are using a scanner or entering the number by hand. My point is that he does not need the buttons to choose. All he needs is a field with that code in it. It will handle a number entered manually or using a scanner.
If he can not remove the "Ask", he can program his scanner to work with the button.
Most scanners have a way to program them for different types of barcodes (code 39, 128, UPC, etc) They also come with a way to include/exclude a return with the number. If the scanner is not programmable, there is usually scan codes to set them up. If he has the scanner add 2 returns after the number, the button will work.
If he can not remove the "Ask", he can program his scanner to work with the button.
Most scanners have a way to program them for different types of barcodes (code 39, 128, UPC, etc) They also come with a way to include/exclude a return with the number. If the scanner is not programmable, there is usually scan codes to set them up. If he has the scanner add 2 returns after the number, the button will work.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: ASK Command Return Button means "OK"
Hi,
I can see the problem - the signal from the scanner is coming as keyboard input, and has to be caught somewhere. But as soon as you focus on any field (on mobile), this nasty keyboard pops up, covering half the screen.
This way, opening an ask dialogue is a good way to fetch it. Only now the user sees some strange data coming in, and has a great opportunity to manipulate it, and mess the things up. So it would be fine if the incoming data itself would "hit the OK button", but I assume there's no way to do it.
Would I have to do this, I'd try the following approach:
To scan, the user has to press a "EAN scannen" button:
Card "ScanPage" only has the prompt "Bitte jetzt scannen!" ("Scan now!"), a "Cancel/ Abbrechen" button, and 2 handlers in the card script:
Card 1 now has the last handler:
Caution: Keydown only reports chars and numbers, so if the scanner sends control chars this doesn't work. Use RawKeyDown in this case.
And - this isn't tested, it's just an idea. So it may not work at all ...
Have fun!
I can see the problem - the signal from the scanner is coming as keyboard input, and has to be caught somewhere. But as soon as you focus on any field (on mobile), this nasty keyboard pops up, covering half the screen.
This way, opening an ask dialogue is a good way to fetch it. Only now the user sees some strange data coming in, and has a great opportunity to manipulate it, and mess the things up. So it would be fine if the incoming data itself would "hit the OK button", but I assume there's no way to do it.
Would I have to do this, I'd try the following approach:
To scan, the user has to press a "EAN scannen" button:
Code: Select all
global gScanData
on mouseUp
put empty into gScanData
go card "ScanPage" of this stack
end mouseUp
Code: Select all
global gScanData
on keydown what
put what after gScanData
end keydown
on returnkey
go cd 1 of this stack -- or where ever ...
ScanDone
end returnkey
Code: Select all
global gScanData
on ScanDone
put gScanData -- or do something useful with it ;-)
end ScanDone
And - this isn't tested, it's just an idea. So it may not work at all ...
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: ASK Command Return Button means "OK"
i've tried to use just the field below with the code of the button, i can write the code manually, that's no problem. But when i scan it with the barcode reader, no line of number appears in the field.. so the button was my compromise solution. But i'll try it again tomorrow with the code from you.Newbie4 wrote: ↑Tue Jan 16, 2018 12:32 amBut the ask is in the button. I assume that the user presses a button to select if they are using a scanner or entering the number by hand. My point is that he does not need the buttons to choose. All he needs is a field with that code in it. It will handle a number entered manually or using a scanner.
If he can not remove the "Ask", he can program his scanner to work with the button.
Most scanners have a way to program them for different types of barcodes (code 39, 128, UPC, etc) They also come with a way to include/exclude a return with the number. If the scanner is not programmable, there is usually scan codes to set them up. If he has the scanner add 2 returns after the number, the button will work.
& yes, my scanner is programmable to include/exclude a return after the numbers. But the return after the numbers causes a jump into the 2nd line, but no "return" like an OK.
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: ASK Command Return Button means "OK"
Are you using a "software" scanner or a hardware scanner with your Android phone?
I tested both solutions and they work on a computer. My scanner does not connect/input into my cellphone so I could not fully test it under Android. You might have to set the focus to the field and turn off the keyboard. The code works, so it must be a problem with the scanner or the Android platform.
You might have to experiment some more or post a question on the Android forum. Maybe someone can help you there.
These are the two methods that worked for me:
1. With the button method and using the Ask command, you have to program the scanner to include 2 "returns" after the number. One to end the input and the second one for the "Ok" button of the dialog.
You can leave the code as it is
2. With the field method you have to add the "returnInField" and "enterInField" scripts to the field to limit the input to one line (the number) and return control to your program. You only need to program the scanner to include only 1 "return" after the number. You do not need any buttons for this method and it also enables you to manually input the numbers.
remove the button and just use the field
in the script for the field "field_EAN" add this:
Make sure that your scanner is working with a simple test field. If you do not see any numbers, then try setting the focus to that field and see if that makes a difference.
Good luck and come back with what happens.
I tested both solutions and they work on a computer. My scanner does not connect/input into my cellphone so I could not fully test it under Android. You might have to set the focus to the field and turn off the keyboard. The code works, so it must be a problem with the scanner or the Android platform.
You might have to experiment some more or post a question on the Android forum. Maybe someone can help you there.
These are the two methods that worked for me:
1. With the button method and using the Ask command, you have to program the scanner to include 2 "returns" after the number. One to end the input and the second one for the "Ok" button of the dialog.
You can leave the code as it is
Code: Select all
global EANTemp
on mouseUp
ask "Bitte scannen Sie den EAN Code!" //English: Please scan the barcode
put it into EANTemp
put it into field "field_EAN"
end mouseUp
remove the button and just use the field
in the script for the field "field_EAN" add this:
Code: Select all
on returnInField
(put your code to process the number here)
end returnInField
on enterInField
(put your code to process the number here)
end enterInField
Make sure that your scanner is working with a simple test field. If you do not see any numbers, then try setting the focus to that field and see if that makes a difference.
Good luck and come back with what happens.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/