Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Fri Nov 24, 2017 12:17 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Nov 27, 2008 12:45 pm 
Offline

Joined: Sun Nov 09, 2008 7:01 pm
Posts: 21
Hi,

I'm using a 24 key keypad on a G58E. How can I detect when, say, F5 is pressed on the keypad using HotKeyV2?

Yesterday I spent over 4 hours trying to figure out how to simply detect a keypress. Multiple functions later, I finally stumbled across HotKeyV2 so I obviously wasted a lot of time looking at a registration function and then other functions handling keypresses.

So I finally discovered that I could detect when the number "8" key is pressed by using ASCII code 56. Unfortunately I had to find an ASCII lookup table on the Internet as I didn't see anything in the manuals. So I can do this now. However, how do I do this for other keys that don't exactly have ASCII codes? I found keycodes in one part of your reference guide but these do not help. In addition, the keypad translation table just looks like a garbled mess to me and I see no reference anywhere to that either so I don't understand it at all.

Why does something like this have to be so convoluted and difficult?

Thanks,

B Blair.


Top
 Profile  
 
PostPosted: Mon Dec 01, 2008 8:13 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
BBlair,

I am sorry that detecting a key is turning out to be such a challenge. The Hotkey object is the way to go. I just reread the documentation on the HotKey object and tend to agree that the description of the HotKeyValue property is confusing. In particular, while you can use the value 56 to detect the 8 key, it is much easier to use the value '8' (including the single quotes), which was the real intent.

As for the function keys, those are somewhat less obvious, as you pointed out. The value for F1=241, F2=242, F3=243, F4=244, F5=245

I will rework the docs for the hot key to make that a bit less painful.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Mon Dec 01, 2008 8:31 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
The new documentation for the HotkeyV2's HotKeyValue property reads:

HotKeyValue
dim HotKeyValue as integer
Data Type: integer

When using a keypad this is the ASCII value of the Keyboard mapping in the KeyTranslator. When using a keyboard this is the ASCII value extracted from the keyCode of the keyboard.

For most normal characters, you can simply use the character itself in single quotes. For instance, to handle the "8" key on a keypad, you can enter '8' (include the single quotes) You could also, if desired, enter the raw ASCII code of 56, although this might be less readable.

Some common other keys you might wish to handle include:
Function Keys
F1=241, F2=242, F3=243, F4=244, F5=245
Arrow Keys
Up=0xE5, Down=0xE2, Left=0xDB, Right=0xE4, UpLeft=Home=0xDC, UpRight=PgUp=0xED, DownLeft=End=0xD9, DownRight=PgDn=0xEA
Misc Keys
Enter=10, Esc=27, Delete=8


The complete list of keycodes can be found here. (Be sure to use the number and not the name for this property).

(Note, some of the formatting was lost when putting it on the forums -- it is more readable in the actual documentation)

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Mon Dec 01, 2008 7:31 pm 
Offline

Joined: Sun Nov 09, 2008 7:01 pm
Posts: 21
Thanks Jeremy,

I thought I was going crazy there for a while. Incidentally, I had tried using "8" with double quotes (I had never thought to use single) and since it didn't work I had gone for the ASCII code.

By the way, the other reason I was having problems was because all of the G55/G58 type demos do not work properly with a 24 key keypad. In fact, I'm not sure they work properly with the 40 key keypad either. My G58 is on order so I am just using the simulator. However, none of the Qlarity tutorial demos I have tried properly support either keypad (I'm also using the latest Qlarity version 2.58).

Certain demos might say to use the arrow keys. They never work. It seems that the mappings are entirely wrong somehow. If these were correct then I probably could have easily figured out how to detect keypresses from these sample apps, but obviously that wasn't possible. I should point out, however, that in one of the demo apps it allows you to type into some kind of text box. When I did this the keys showed up properly as I typed them. However, trying to navigate screens while within a demo application has always been hit or miss. It almost seems as though the demos were ported over from your touch screen versions but the keypad input was not implemented correctly and this then went unnoticed.

Anyway, I just thought I'd let you know.

Thanks!

B.Blair


Top
 Profile  
 
PostPosted: Tue Dec 02, 2008 7:46 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
The G55 and G58 demos were written from the ground up for those terminals. I just tested them out on both 24 and 40 key devices and in Simulation View on both types of device and they both seem to operate correctly, including normal navigation, arrow key input and textual input.

I am wondering if you somehow got a custom key definition stuck in your key translator object. You might try going to Layout View, selecting the KeyTranslation object in the Object Tree and setting the translationTable to Keypad_24Key and the translationTableShifted to Keypad_24Key (shifted).

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Tue Dec 02, 2008 1:11 pm 
Offline

Joined: Sun Nov 09, 2008 7:01 pm
Posts: 21
Ok, I understand all of this now. My default keypad wasn't totally set up right, but on top of that, I just somehow never associated the Function keys with what I now know are "SoftKeys". I was trying to use the arrow keys when I should have been using the function keys, and probably vice-versa.

Funny, I was confused by this for over 3 months off and on but I had more important things to think about so I didn't really worry about it.

Ok, all is clear now.

Thanks,

B.Blair


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group