Tab stops not working

rhinocommon-v6
rhino6
csharp

(Sebastiano Del Gobbo) #1

Environment:

  • Rhino 6 SR12 on Windows
  • Plug-in development with RhinoCommon, C#

Problem:
My plug-in adds a panel to Rhino.
The panel contains a button that, when clicked, shows a Form full of other controls.
I have properly set the TabIndex property for all the controls in the second form but focus doesn’t change when user presses TAB key.
The second form doesn’t intercept any keyboard events.
I have noticed that all the forms visualized using the following code have the same behaviour: focus doesn’t change pressing TAB key.

SMDevelopForm form = new SMDevelopForm();
form.Show(Control.FromHandle(RhinoApp.MainWindowHandle()));

I have to use this code to show the form because I have to hide it as user has to select Rhino document elements (as in Grasshopper).
Tab order works fine if the form is shown using this code.

SMDevelopForm form = new SMDevelopForm();
form.ShowDialog();


(Dale Fugier) #2

Hi @software_comas,

This is a know issue with modeless forms (of any kind) created by DLLs, which is what a Rhino plug-in is. here is the gist of the problem:

https://wiki.mcneel.com/developer/sdksamples/tabkey

There is a WinForms sample that demonstrates how to get around this limitation in our samples repo in GitHub.

https://github.com/mcneel/rhino-developer-samples/tree/6/rhinocommon/cs/SampleCsWinForms

See the “ModelessTab” sample source.

– Dale