I just committed a rewrite of the RhinoView mouse callback system in the WIP in order to make the mouse callbacks more consistent and accessible. Please try it out and let me know if there are any additions or changes you would like to see. I’m very open to suggestions.
RhinoView mouse events are still intercepted with the Rhino.UI.MouseCallback class in RhinoCommon, but there are new virtual functions that you can override to better control exactly how you want to control mouse behavior. The virtual functions that I am referring to are:
OnBeginMouseMove
OnMouseMove
OnBeginMouseDown
OnMouseDown
OnBeginMouseUp
OnMouseUp
The ‘Begin’ virtual functions are guaranteed to be called at the very beginning of RhinoView processing a mouse event. At this point in time, Rhino has not done anything to process the mouse. These functions are all passed a MouseCallbackEventArgs parameter. If you set Cancel to true on this parameter, then the default Rhino mouse processing code will not be executed.
The other virtual "OnMouseMove’, ‘OnMouseDown’, and ‘OnMouseUp’ functions are guaranteed to be called at the very end of a mouse event. This happens even if a Cancel has been set to true and you can inspect the MouseCallbackEventArgs parameter to see if Cancel was set to true.
Something similar to the mouse callback would be useful. Any key event in RhinoView, with a Cancel property on the event args to prevent main Rhino from handling the key event (like sending to command-line).
@steve, I’d like to see also a way to set mouse to specific location in a view, and whether the mouse cursor shows or not. I have in my old mouse/key event handling patch (D16) two wrapper functions that helped with that: CRhinoView_ShowCursor and CRhinoView_SetCursorPos. I can add them if you’re OK with those. have added D20 for your consideration.
Please note that it is impossible to change the location of the mouse cursor on the Mac, so any user interface designed with this in mind will never work on the Mac. On the Mac, the location of the cursor is under the user’s control, not the program’s control.
It definitely is possible to change location of mouse cursor on Mac. For instance Blender does it to implement its continuous grab (mouse pointer “wraps” around an editor area = when in action and move off the left reappear magically on the right).
The use case for this is when mouse is hidden for and good mouse look around is wanted. This is what I’d do for a walkabout-type implementation. Naturally one wouldn’t do this with the mouse cursor still visible…