Set focus to rhino window in python

I wish to popup a dialog without loose the focus to Rhino (or get back the focus) this is because a keyboard with macros does not send keystrokes to the main window
Rhino_Orto.py (5.2 KB)
Rhino_Orto.xaml.txt (5.0 KB)
Also a methot to toggle a window state (hidden - visible ) instead of block if already is open?

Hi @JavierG,

you might try RhinoApp.SetFocusToMainWindow() method or alternatively make your form dialog listen to key events and pass them through to Rhino using RhinoApp.SendKeyStrokes

_
c.

Is IronPython not rhinocommon

I am using both recommened methods in my iron-python scripts together with WinForms. Since you’re importing the Rhino namespace in your script, why don’t you try just adding this to the Load event of your WPF Form:

Rhino.RhinoApp.SetFocusToMainWindow() ?

_
c.

1 Like

yes it works. Thank you very much for taking the time and sharing your experience with me :smiley:

1 Like