I'm trying to use the spaceball 5000 as a 3D mouse in C#. I'm moving the cursor just fine, but I need to be able to click. For some reason, I can't get keyboard feedback at all.
Do I need to configure the control panel to "Button 1, Button 2 etc" then do something else?
I've even tried assigning a button to the spacebar, escape or tab and listening for qwerty keyboard input, but that's not working either.
Some strange things:
When I press the button assigned to tab or escape when using a normal application, they work just like that key. When I use the spacebar button nothing happens.
I'm using the TDconnexion namespace from the NASA Wildwind demo, along with the following code:
Code: Select all
TDconnexion.TDxDeviceWrapper m_TheInputDevice;
public static TDconnexion.I3DxSensor m_TheSensor;
TDconnexion.TDxSensorInputEvent m_SensorEventHandler;
static TDconnexion.I3DxKeyboard m_TheKeyBoard;
TDconnexion.TDxKeyboardEvent m_KeyUpEventHandler, m_KeyDownEventHandler, m_KeyEventHandler;
public delegate void SensorEvent(double x, double y, double z);
private static SensorEvent m_SensorEvent;
private static Connection instance = new Connection();
private Connection()
{
m_TheInputDevice = new TDconnexion.TDxDeviceWrapper();
if (m_TheInputDevice != null)
{
m_TheSensor = m_TheInputDevice.Sensor;
m_SensorEventHandler = new TDconnexion.TDxSensorInputEvent(NotifySensor);
m_TheSensor.SensorInput += m_SensorEventHandler;
m_TheKeyBoard = m_TheInputDevice.Keyboard;
m_KeyUpEventHandler = new TDconnexion.TDxKeyboardEvent(NotifyKeyboardUp);
m_TheKeyBoard.KeyboardEventUP += m_KeyUpEventHandler;
m_KeyDownEventHandler = new TDconnexion.TDxKeyboardEvent(NotifyKeyboardDown);
m_TheKeyBoard.KeyboardEventDOWN += m_KeyDownEventHandler;
m_TheInputDevice.Connect();
}
}
private static void NotifySensor()
{
C3DxVector v = m_TheSensor.Translation as TDconnexion.C3DxVector;
m_SensorEvent(v.X, v.Y, v.Z);
}
private static void NotifyKeyboardUp(Int32 nKey_p)
{
}
private static void NotifyKeyboardDown(Int32 nKey_p)
{
}
public static SensorEvent SensorEventHandler
{
get
{
return m_SensorEvent;
}
set
{
m_SensorEvent = value;
}
}