Deriving button from keyDown or keyUp event

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
madeinttown
Posts: 4
Joined: Tue May 26, 2009 2:02 pm

Deriving button from keyDown or keyUp event

Post by madeinttown »

Hello,

I am trying to determine which button (physically) is triggering the event. The event carries a "button ID" that details what functionality the button was assigned, but not the physical button. Specifically, I am using the SpaceNavigator, and would like to assign a single functionality to the left and a single functionality to the right button.

For example:
If the user assigns the left button to be "Zoom", in my application it will perform FunctionalityA(). If the user then assigns the left button to be "Decrease Sensitivity", it will still perform FunctionalityA(). Even if the right button is also set to "Decrease Sensitivity", the left button will still perform FunctionalityA() (while the right button would perform FunctionalityB()).

I guess the simple way of putting it is: I want to ignore the 'assigned' function and base functionality off of its physical location.

I toyed around with a couple of ideas, but could not find an appropriate solution. The IsKeyDown(), IsKeyUp(), KeyDown(), and KeyUp() functions/events want to use a keyID that represents the key's assigned 'functionality'. Whereas GetKeyLabel() and GetKeyName() work with the physical key's number.

Is there a trick or function I am missing?

Thanks,
Mark
jwick
Moderator
Moderator
Posts: 3359
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

The only way you are going to get the raw data is to get the driver out of the way. If the driver is there, the user can always remap something to a button.

You can also create a config file for your application that doesn't give them any options like decrease sensitivity. Delete all that stuff from the config and that's all they can do.

The other option is to use one of the APIs that doesn't work with the driver. This is ok for now, but the next version of the driver will allow the user to remap the buttons no matter what API you use.
madeinttown
Posts: 4
Joined: Tue May 26, 2009 2:02 pm

Post by madeinttown »

It isn't that I don't want the user to remap the keys, I just want to ignore whatever they are mapped to and base my functionality on whether its the left button or right button.

However, it seems like by restricting the users ability to remap keys through a config file will inadvertently allow me to do this. I can configure the keys to always be mapped to a function (lets say "Fit" for the left key and "Save" for the right key), and use that as the key identifier. So "Fit" would be used as if it said device button 1, and "Save" would be used as if it said device button 2.

(well, of course it would be best to use "Button 1" and "Button 2" instead of "Save" and "Fit", but its early and I had already type it that way. :D )
madeinttown
Posts: 4
Joined: Tue May 26, 2009 2:02 pm

Post by madeinttown »

Btw, where can I find info on the setting up a config file? I don't see it discussed in the SDK...
jwick
Moderator
Moderator
Posts: 3359
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

There isn't any documentation on it and that format is going to be replaced at the next major release. It is best to use the GUI to edit it. OTOH, in your case, you'll have to edit it with notepad. Assign the correct EXECUTABLE, and remove all the functions you don't want from the ButtonNumbers array.
Post Reply