Python GUI: mouse wheel


using GDI+ with Iron Python I noticed that when the Form is shown, I cannot zoom into Rhino using the mouse wheel (Pan by right button works fine)
For example Mark Meier’s Circle UI shows this behaviour.
Is this to be expected ?


Yes this is because the UI Form has the “focus” so the mouse wheel is captured by the UI and not the Rhino viewport. So you have to use Ctrl+right-click and drag to zoom.


(Steve Baer) #3

You can somewhat work around this by using


instead of


This happens using Rhino.UI.Dialogs.ShowSemiModal()
Ctrl-right-click is fine (I did not remember that …)

Thanks Mark and Steve.



Is there any way to switch the focus from the Form to the Viewport when clicked on the respective interfaces? The workaround for Zoom is fine (Ctrl + Right click), but am unable to select objects in the viewport when the Form is displayed.

Thanks all.


What we do when we need to select in the Rhino viewport when the UI is up is hide the form, execute one of the rs methods to select, then when that returns show the form again. This has worked well for us. This a code snippet:




You often need to reset the Rhino command prompt and cursor after this is done as they are not reset automatically when using a GUI. So we do this:

System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default