Fit Button

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

Moderator: Moderators

Post Reply
cad
Posts: 5
Joined: Fri Mar 07, 2008 3:18 pm

Fit Button

Post by cad » Wed May 21, 2008 4:59 pm

I'm using the below to init the SpaceNavigator.

When a button is hit, I recieve notification that either button 1 or 2 is hit.

If I go to the preferences panel and change Button 1 to Fit, how do I tell that Fit is now associated with Button 1?

If our PC implementation Fit returns back a button id of 31 which we can then perform the appropriate action.

Thanks

Tim


OSErr err = InstallConnexionHandlers(MyMessageHandler, 0L, 0L);

clientID = (long)RegisterConnexionClient('CS31', (UInt8 *)"\pViaCAD 3D", kConnexionClientModeTakeOver, mask);

flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan » Thu May 22, 2008 7:08 am

On OS X, the "Fit" command is an application specific command instead of a physical or virtual button press. There is a specific event from the driver called kConnexionCmdAppSpecific for this. In your MyMessageHandler callback, you can add a case statement for processing these events. For example:

Code: Select all

case kConnexionCmdHandleAxis:
   //  do motion processing
   break;

case kConnexionCmdAppSpecific:
   if (msg->value == 31)
      // handle Fit command
      MyFitRoutine();
   break;

cad
Posts: 5
Joined: Fri Mar 07, 2008 3:18 pm

Post by cad » Thu May 22, 2008 11:36 am

Thanks! Fit now works very well.

When a user assigns to the button say "Pan/Zoom Only", how is the app to process that type of event? I do not get a button message (kConnexionCmdHandleButtons or kConnexionCmdAppSpecific).

Regards

Tim

flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan » Fri May 23, 2008 10:39 am

Button commands that have to do with filtering motion data (Pan/Zoom Only, Tilt/Spin/Roll Only, Pan Only, Zoom Only, Toggle Translations, Toggle Rotations, Toggle Dominant Axis) or changing device settings (Increase Speed, Decrease Speed, Calibrate) are handled by the driver. There's no need to process these within your application.

A note on Pan/Zoom Only, Tilt/Spin/Roll Only, Pan Only, and Zoom Only. These commands are only active while the button is being pressed. Once you release the button, the previous state of events being sent by the driver resumes. Only the Toggle XX commands actually change the filtering of data even after the button is released

Post Reply