Click Click Click Click - ETO.Webview focus on MacOS

OK, this is a user pain experience when using ETO.WebView as a UI on MacOS.

I’ve recently added a module that needs the user to select geometry in the Rhino document from my GH/ETO.Webview based plugin.

This becomes an absolute click fest.

Click the button in my UI to activate the selection

Click on Rhino ONCE to change the focus from the Webview UI to the Rhino Doc

Click on the actual geometry you want to select in the Rhino

Click on the Webview to change the focus to the UI

Click on the next selection button and repeat the click/click/click/click

Four clicks to do what only takes 2 clicks in Windows is just clunky - is there a way to make not have the change of focus clicks needed??

Cheers

DK

@curtis can you help with this?

1 Like

sorry I didn’t tag the right Curtis. Should be @curtisw

@kiteboardshaper could be this is more of a Mac issue than a Rhino issue from what I currently understand. What might help a bit is bringing the focus to Rhino explicitly.

Rhino.RhinoApp.SetFocusToMainWindow()

Hi Gijs,

So if I add that line to my python code that just before I call the GetPoint (etc) it should set focus to the Rhino window? Is there a similar command that can force focus back to the ETO.WebView window? As I could call that after Rhino returns the geometry after selection.

Cheers

DK

yes

imo this is not really needed, at least in my testing, I can always click directly in the floating dialog even when it is not active, but

self.Focus()

seems to work here

Hi Gijs,

Thank you - the Rhino.RhinoApp.SetFocusToMainWindow() does remove one extra click - that was excellent.

The returning focus to the ETO.Webview window might require something a little more - as the code that asked the user to select a point (etc) in the Rhino environment is running in a GH Python script inside of a headless GH.

The UI is a webpage that submits to a web server that is running inside of the headless GH and sets a boolean in a panel to tell the Python code to run.

Is there are way of finding my ETO.Webview window in Python and telling the OS to return focus to it?

Cheers

DK

I also faced such a problem Eto.Forms Form in MacOs. it helped.


protected override void OnMouseEnter(MouseEventArgs e)
        {
            base.OnMouseEnter(e);
            Focus();
            Invalidate();
        }

        protected override void OnMouseLeave(MouseEventArgs e)
        {
            base.OnMouseLeave(e);
            Rhino.RhinoApp.SetFocusToMainWindow();
            Invalidate();
        }

@kiteboardshaper the thing @taraskydon is using is currently the way to do that, I’m using those methods too. It still feels a bit like a workaround though and I hope there are ways to improve this, without having to use these overrides for every single dialog. I’ll ask Curtis

1 Like