Eto Plugin hiding behind Rhino even after plugin got focus

Hi,

I am current working on a Rhino 5 Plugin, in C# with the ETO forms GUI.

Once my plugin is loaded an ETO form is popping up as expected, but once I focus Rhino, by click on the rhino interface, the plugin goes behind Rhino, this is all very normal behavior. My problem is when i want to bring do something in my plugin again, normally one would either ALT+TAB to focus the plugin, or go to the taskbar and find it there. But as soon as my plugin gets focus, it shows up for a very brief second, and then hides behind Rhino again.

One way to get my plugin in front of rhino again is to minimize Rhino, drag my plugin to a different screen, the maximizing Rhino, and lastly dragging the plugin in front of Rhino. This is of course not a desirable work-a-round, even for multi screen users.

Is that a problem anyone has experience before?

Best Regards,
Jesper Ravn-Nielsen

Hi @Jesper_Ravn-Nielsen,

Without code I can only speculate. But it sounds like you are not setting the form’s parent window.

Here are some Eto samples for Rhino 5 for Windows that may help you.

https://github.com/dalefugier/SampleCsEto

– Dale

Hi @dale, thanks for your response.

I have looked at the SampleCsEto project, and that is actually what got me started in the first place.

You are correct that I had not set the parent of the form (I assume that’s what’s called the owner in Eto). But even when I set the owner of the form as you have showed in the Sample project, I still get the problem, is it my implementation of the owner that is wrong? Here is at least the file CondorCommand.cs (1.5 KB) where I declare the form and owner, it should look very much like the sample project.

I have also investiagted the bug further, and I have found out that if you minimize my pluing by clicking the minimize button (the one looking like underscore) in the top right corner (on windows), it behaves correctly and the plugin maximizes correctly in front of Rhino, but if I have my plugin in front of Rhino and then click on Rhino, the plugin goes behind Rhino and will not maximize correctly, and behave as described in the original post.

On further investigation, Setting the owner works well for windows, but since using

new Eto.Wpf.Forms.HwndFormHandler(RhinoApp.MainWindowHandle());

The fix will not be able to work for a cross platofrm plugin. Is there a way to set the owner without using WPF, since wpf doens’t play nicely with mac?

@Jesper_Ravn-Nielsen,

On Rhino for Mac, your code will look something like this:

var dialog = new MyEtoDialog()
var rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow);

– Dale

Alright, thank you :slight_smile: