SDG System Vs SDG Mice

<< Back to the SDG Toolkit page

How to: The System Mouse vs SDG Mice: Things you need to know.

  • Why system and SDG mice are very different things
  • How to use the SDGManager's EmulateSystemMouse property to manage the system mouse.
Download: SdgMouseParkingDemo.zip
Source: SdgMouseParkingDemoSrc.zip
  • Unzip all files (executables plus dependancies) into a single folder.
  • The executable should run just by clicking the .exe
  • For recompiling the source, you may have to reset the sdgt reference to point to where you had put the SDGToolkit dll.
  • See the end of this page for a description of what this program does.

Windows offers only a single system mouse, and consequently draws only a single system cursor on the screen. When you plug in multiple mice, windows just combines their input to move the system cursor. Similarly, all widgets in windows react to input from the single mouse.

Because SDGToolkit provides multiple mice and cursors (without the knowledge of Windows), it directly violates the Windows GUI. This creates several issues (see the SDG Toolkit paper in the How To section for a complete discussion).

  • Setting SDG Mice coordinates
  • What should we do with the system mouse?
  • Normal GUI widgets won't work properly with SDG mice

Setting SDG Mice coordinates. In windows, mice coordinates are normally reported relative to a window. SDG mice work differently.

  • By default, coordinates are always relative to the top left corner of the screen. This is fine for a full screen application, but bad if your SDG application lives in a window.
  • You can tell the SDG Toolkit to deliver coordinates so they are relative to the insider top-left corner of a window (a Form). To do this, set the RelativeTo property in the SDGManager to a form.

What should we do with the system mouse? The system mouse is still around when you use SDGToolkit. However, it does provide several strategies for dealing with it.

  • Parking the mouse. (Recommended). The SDGManager has a property called Emulate System Mouse. When this is set to Park, the system mouse is moved to the location given in ParkSystemMouseLocation, made invisible, and left there. That is, it does not move no matter how you move any of the SDG mice. This means that clicks outside of the SDG window will be ignored. The downside is that standard non-SDG widgets will not work (including your window title bar options), nor will you be able to do any task switching through mouse selection. This is why you have to press Alt-F4 to close the window, or Alt-Tab to switch between applications.
  • Full screen applications. Another way around this problem is to park the mouse, and make the application full screen. This at least removes the visual conflict of having an SDG application surrounded by a non-SDG environment.

Normal GUI widgets won't work properly with SDG mice. Normal GUI widgets won't work at all if the System Mouse is parked. Yet you can have the System Mouse follow a specific SDG mouse.

  • Set the sdgManager's Emulate System Mouse to Follow Mouse, in which case it will follow Mouse 0 by default.
  • Set a property called MouseToFollow and indicate the mouse ID if you want it tofollow another mouse.).
  • Expect strange behaviours. Other people will expect their mouse to work like a system mouse, but it won't. Also, other people's mouse actions may interfere with your use of the system mouse.
  • If you click do click outside the SDG Window, several unpleasant things happen.
    • Your SDG application (and the other mice) will stop working. You are essentially parallizing everyone else.
    • your system mouse cursor will appear, while the SDG mouse cursors will also stay visible.
  • In practice, its best not to use this mode unless you really know what you are doing or have a good reason for doing it.

Confused? It all comes from having a window system with an ingrained notion that there could ever be a single mouse pointer. All commercial systems work this way. how bizarre.

Sdg Mouse Parking Demonstration Program. Download and try the program included on this page. It demonstrates what happens. Beware: this is ugly behaviour.

  • The form is SDG aware, and starts up with the mouse parked.
  • It contains a standard button that will count how many times it has been clicked
  • The form itself contains a message that says that the mouse will be unparked after it has been clicked 5 times, and counts how many times it will have been clicked.
  • The cursors are labelled to show which one is the first (0) cursor, as that one will behave like the system mouse (sort of) after the mouse is unparked.
  • For the first 5 clicks, the system mouse is unparked. Try clicking on the button and/or outside the window. It should have no effect.
  • After 5 clickes, the system mouse is unparked. Try clicking on the button with the non-0 mouse (nothing should happen), and then with mouse 0 (it will occassionally increment - it works better if you move the mouse as you click it).
  • Then try clicking outside the window with the non-0 mouse (nothing should happen) and with mouse 0 (the system mouse will appear, and the SDG Mice cursors will freeze). Both mice will now move the single system cursor.
  • Then try clicking back into the SDG window with the system mouse. Things should work again.