Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / EditBox - Can you read / detect the Enter Key being pressed (CR/LF)?

Author
Message
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 8th Feb 2013 09:54
I know that when entering text into an EditBox that the Focus of that EditBox is lost when the Enter key is pressed (I also know that this is a problem on the Andoid in V1088 and will be fixed in the next release) ..... However...

Does anyone know if it is possible to read or detect the Enter key from the EditBox itself. I think it is a CHR$10 (CR/LF) I was hoping that I could write a routine to read each character entered and also read when the Enter key was entered? Any Ideas please?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2013 10:47
To stop the editbox from losing focus but you could use:


Although I haven't tried that it might keep focus and add the carriage return for you.


this.mess = abs(sin(times#))
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 12:06
BX: You're getting sloppy. I'm seeing a lot of ifs, maybes, and untested workarounds from you lately.

Cheers,
AgentSam - Just keeping you on your toes. xD
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2013 12:08 Edited at: 8th Feb 2013 12:14
I'm not lazy, just busy but still trying to help

I'm always on my toes, while the baby is asleep anyway...

EDIT: OK so I tested it and it didn't work, sorry!

EDIT2: Perhaps you can help on this one Sam? Since you're not busy...


this.mess = abs(sin(times#))
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 12:15
Oh yea, you became a dad recenly... I think I've forgotten to congratulate - so huge congrats! <3

And I have to say, it really changes a man - after having a child you learn about completely new levels of love - levels you did't even know existed. Wonderful times.

Cheers,
AgentSam
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2013 12:17
Well it was about 10 months ago now and my third time around but thanks AS!

Yes, if you can program after only 2 hours sleep and with a baby screaming in the next room you can program any time.

They are a challenge but they are worth it


this.mess = abs(sin(times#))
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 12:20
Quote: "EDIT2: Perhaps you can help on this one Sam? Since you're not busy..."


I'm going to pass on this one.. but I'll say that "Rudders" was on the right track himself. If he ditches the built-in EditBox routines completely, and rewrites his own input/editbox routines based on getRawKeyPressed, he'll be golden.

Cheers,
AgentSam
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2013 12:26
If he does and it works I might be after a copy myself, they're driving me mad today


this.mess = abs(sin(times#))
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 8th Feb 2013 14:30
Hi All, Thanks for the input, oh and congrats on the baby.

I had thought of GetRawKeyPressed but as I will be using a bluetooth barcode scanner as the input device to the Android device there will be No key presses to use GetRawKeyPressed.

I will see if I can copy the editbox into a string and test the string each frame for the Enter Key (CHR$10)... If that is at all possible?
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 8th Feb 2013 15:04
NO GO!

It was simple enough to test each character entered by using GetLastChar() which returns the ASCII code for last character entered..(But probably using the keyboard!) However the Enter Key (LF = CHR$ 10) is not read as input!

So stuck again! Does anyone know how to read a Line Feed / CHR$ 10 from and EditBox but using the GetRawKeyPressed() call?

Mmmmmm maybe not?
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 8th Feb 2013 15:05
Sorry, rushed the post... I meant to say:

Does anyone know how to read a Line Feed / CHR$ 10 from an EditBox but NOT using the GetRawKeyPressed() call?
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 15:54 Edited at: 8th Feb 2013 16:00
Hmm.. Take a look at this scancode list: AGK Scancodes

Although the above list is far from complete, it will give you a decent starting point... (Check out the UCF collection for a slightly more complete list.)

For those keys that aren't on the list, you could use the code snippet here:
GetAnyKey function - for Tier 1

I think you'll be able solve the problem with this... And I'm sorry, but the EditBox functionality in AppGameKit is rather limited. You'll do best by "rolling your own".

Cheers,
AgentSam
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 16:13
But now I can see why you want to detect the "enter keypress" - it's because your barcode reader appends it automatically at the end of the barcode string... so you'd like to detect it, eh?

I've actually worked with many Point Of Sale devices, when I was a device driver coder for a company selling POS-equipment and cash-register software. I had to create entire COM-interfaces for many devices according to the POS standard of the day.. The standard itself was rather beautiful and well designed, but no fun to implement. XD

Hopefully things in the POS arena have advanced a bit from those days, but maybe not.

Cheers,
AgentSam
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Feb 2013 16:32
For completeness sake, I must comment on this "as I will be using a bluetooth barcode scanner as the input device to the Android device there will be No key presses to use GetRawKeyPressed."

I did read that... but are you sure? Most scanners that I have worked with have sent their data through a keyboard inferface of one kind or another. It is quite likely that yours will do the same (the bluetooth interface on that scanner will propably emulate a keyboard input device, but don't quote me on that), and then GetRawKeyPressed will work with it - but so should the EditBox.

Well, I guess we could use a bit more information here:
- What model is the barcode scanner? (So we can check out the specs.)
- Can you give a sample of the data that it outputs?
- Are you able to capture the scanner data into the EditBox, excluding the carriage-return?

Cheers,
AgentSam
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 12th Feb 2013 10:15
Hi AgentSam, thanks for your input, sorry for delayed reply been bussy with a crashed PC and full reload.... and I lost my AppGameKit project that we have been discussing, very sad man indeed...

You are of course right that the barcode scanner is using the HID conversion and therefore keyboard input, so I should be able to detect the Return Key... When I have either managed to recover my deleted project or re-written it from scratch!

It was interesting to hear of your experience with scanning devices and POS solutions, I have been runninig an EPOS development company for 15 years now and our solution has been 'out there' for these many years, I was in EPOS prior to starting this company so have seen many changes in the retail systems arena... And hence my current AppGameKit project on stock control, stock taking, stock purchasing, item lookups etc on tablets and phones that integrate to our EPOS software.

Until my disasterous PC crash and lost project! the program was reading exported CSV files and displaying stock item data for counting etc extreamly well... apart from the EditBox not working correctly and that is why I have been trying to overcome this issue. Anyway thanks for the input and when I am back up and 'coding' the project I will post the solution to the issue..

Cheers
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 13th Feb 2013 10:38
Hi All, just incase anyone is following this thread here is an update:

I am re-writing the Stock Take App that reads stock data csv files, not only because of my PC crash but having had a moment of pause whilst reloading everything I realised that the original program did not take account of the possibility of multiple barcodes for each single stock item. I have therefore re-designed the program to read several CSV files (stock data, barcode data, supplier reorder code data) and cross reference each file (Array) in order to find a single stock record when any search code is entered (barcode, stock code, reorder code, etc)

If anyone is doing something similar it would be good to hear from you... Cheers
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Feb 2013 15:06
Regarding edit boxes, they have just received a lot of attention for the next beta so you can press enter in multi line edit boxes and pick up the char(10) character in the string.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 13th Feb 2013 15:09
Windows normally uses char(13)

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Feb 2013 15:20
True, but AppGameKit uses char(10) on all platforms to be consistent.
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 14th Feb 2013 10:03
Hi Paul,

Do you mean the next Beta? I am already using 1088?

Cheers
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Feb 2013 10:10
Yes, he means the next Beta. I have been using editboxes a lot in our latest app and they have needed attention. The next Beta / full release will have these changes and additions in it.


this.mess = abs(sin(times#))
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Feb 2013 14:32
And the fixes for some recently posted bugs? (Numbers 474 and 475 that were pointed out by another AppGameKit user.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Feb 2013 14:37
Text not showing - Is that a Tier 2 bug only as text is showing fine in v1088 Tier 1 for me? Not sure if Paul has fixed it or if it's just t2 only... sorry!


this.mess = abs(sin(times#))
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Feb 2013 15:03
Yes, it is a Tier 2 bug.

I just tested in Tier 1 for v1076 and v1088 and it works fine.

I also tested in iOS and it worked.

So it is a Windows Tier 2 bug.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 07:33:08
Your offset time is: 2024-11-24 07:33:08