PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Buttons and PocketHAL

I've just compared a 1910 and 1940 which I expected would return the exact same keys from GetKeyList(), however I got the following:

Code:

Key 1910 1940
A 195 197
B 193 193
C 194 194
Start 134 134
Aux1 196 195
Aux2 197 196


Why would they be different? What can I do to have a consistent key mapping across devices?
These values are returned in a different order from the OS and there is little I can do about it. They match what GAPI would return.

There is little you can do to get the same mapping except hardcoding values/logic for specific devices.
Ok, thanks. I couldn't find anything from my searches so I thought as much. I am working on an options screen to allow user configuration instead of worrying about it any further.
Hi J.edwards,

Just let the users customize the button mapping. This is the best solution. Save the values on the registry.

Regards.
Hi denthorq: I've done as you said and it works well. I name the keys as in the KeyList structure, eg. "Aux1", "A", "Start" etc. I found I had to ignore any key codes < 130 also and think it's something to do with 'phantom' keys - there was a post in this forum on it some time back.
I've never understood this whole problem with the "phantom keys"... When you do your key mapping code, just check against only values returned in the keylist structure (whatever it's called in PH, I'm not sure) and you are fine. Yes, this means that your users can never map buttons that PH doesn't know about, but I'm not sure how big a deal that is, and it seems a decent trade-off vs. code that may not work on some devices (or special code to deal with phantom values that, again, may not work on some device because for instance there's nothing to stop a vendor from implementing UP as a value of 50 let's say). This goes for using PH, PF, GD or straight GAPI.
"hat your users can never map buttons that PH doesn't know about, but I'm not sure how big a deal that is, and it seems a decent trade-off vs. code that may not work on some devices"

Wrong.
I had for example a request from a user who wasn't able to use default buttons ( nor remap them using default set of keys) because his PPC happened to be a phone and the only buttons that made sense in this particular situation were not included in the default set of GAPI buttons.

Trust me , I tried that approach and had to redesign the app, precisely because of issues like that.
Fair point.