|
gablea on 08/06/11 - 10:50:12
Hi everyone,
Just a quick question how doI handle the keyboard in a QuickBasic applciation? I am desgining a PoS application and I need to use given keys (example would be Shift & f1 for Sign on and right arrow for Sub Total) does anyone know the BEST way to do this? I also need to handle the normal F1 - F12 and 0-9 keys etc Andy
Cyperium on 08/06/11 - 11:08:50
You can get pretty far by using INKEY$
For the ASCII codes look here: ASCII - QB64 Wiki
gablea on 08/06/11 - 14:06:40
So if I wanted to support differnt keyboard but use the same program should I create a mapper program
is there some way to detect if the Chr$(0) is being sent or do I use SCREEN 0, 0, 1, 0 DO PCOPY 1, 0 CLS PRINT "Press Right arrow or Shift + F1, ESC to end." PRINT lastpress$ kbd$ = INKEY$ IF kbd$ = CHR(97) Then lastpress$ = "key a presseds" IF kbd$ = CHR$(0) + "M" THEN lastpress$ = "Right arrow" IF kbd$ = CHR$(0) + CHR$(84) THEN lastpress$ = "Shift + F1" LOOP UNTIL kbd$ = CHR$(27)
gablea on 08/06/11 - 14:20:43
So if I wanted to support differnt keyboard but use the same program should I create a mapper program
is there some way to detect if the Chr$(0) is being sent or do I use SCREEN 0, 0, 1, 0 DO PCOPY 1, 0 CLS PRINT "Press Right arrow or Shift + F1, ESC to end." PRINT lastpress$ kbd$ = INKEY$ IF kbd$ = CHR(97) Then lastpress$ = "key a presseds" IF kbd$ = CHR$(0) + "M" THEN lastpress$ = "Right arrow" IF kbd$ = CHR$(0) + CHR$(84) THEN lastpress$ = "Shift + F1" LOOP UNTIL kbd$ = CHR$(27)
Cyperium on 08/06/11 - 21:08:37
The same ASCII codes should apply to any keyboard configuration. I haven't yet seen any example when this isn't true (at least for the common ASCII codes).
ASCII is the standard. If there are problems with this - even so - then you can always have a detection system. Like:
Cyperium on 08/06/11 - 21:10:31
Reply to this message
Isn't this song just the best?
Smokie - I'll Meet You At Midnight I've taken a few drinks tonight, hope you don't mind. ;) |
|