RhinoEtoApp.MainWindow in doc

Helo

in the documentation API : https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_RhinoApp_MainApplicationWindow.htm

i read :

[ObsoleteAttribute("Use MainWindowHandle or RhinoEtoApp.MainWindow in Rhino.UI")] public static RhinoWindow MainApplicationWindow { get; }

but where is the RhinoEtoApp.MainWindow documentation ?

thanks.

http://api.etoforms.picoe.ca/html/T_Eto_Forms_Window.htm

Note that if you are looking to use the old Invoke mechanism you can instead use RhinoApp.InvokeOnUiThread.

Hello @nathanletwory

MainWindowHandle work on Mac ?

I would like get the size and position of the windows and Eto don’t work…

I am not sure, and I don’t think that getting size and position of windows work as you want them. The MainRhinoWindow is a control inside the application window.

Can you explain what you need the application window size and position for so we can understand better what you are trying to do?

thanks for your help !

I would like place an existing window winform over and attached at a corner of Rhino window.

The RhinoEtoApp.MainWindow returns on Windows an Eto.Forms.Window that is only a very thin and minimal wrapper around the handle - it isn’t a fully fledged window (you’ll see lots of NotImplementedExceptions if you try to inspect it in the debugger).

I can’t see any provisions for events working so that is out of the question at this time.

On Windows if you want to parent your winform form you can use RhinoWinApp.MainWindow. This is used in the WinForms sample project for instance here: https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsWinForms/Commands/SampleCsModalFormCommand.cs#L23

You apparently want to have your window follow the Rhino main window, but I don’t see currently a way to do that. Perhaps the best thing to do is to have your form as a panel, so that it can be docked with Rhino. See https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsWinForms/Commands/SampleCsPanelCommand.cs

Ok thank you !

Not easy !

Oh, and to get back to one of your requests earlier:

WinForms don’t work on the Mac. If you are planning on getting your plug-in to work on that platform it is probably a good idea to start moving your code to using Eto.Forms now.

@kitjmv have a google for win32controls.cs , you can inject pages, buttons, sliders, whatever you like directly into rhino, locking them to rhino as you move it about by hooking its handle via USER32.DLL, sounds complex, but its really as easy as this below (locking a button into the perspective view, no matter where the perspective view is. I am testing a mac wrapper for it today as well to port this to mac, will feedback how I go.

            Win32Window.FromProcessName("Rhino");
            Win32Window RhinoperspectiveView = Win32Window.FromProcessName("Rhino").Children[0].Children[0];
            Win32Button Button = new Win32Button();
            Button.Pos_X = 5;
            Button.Pos_Y = 10;
            Button.Text = "Do Not Click";
            Button.Click += Button_Click;
            RhinoperspectiveView.AddControl(Button); 
            Win32Slider Slider = new Win32Slider();
            Slider.Pos_X = 5;
            Slider.Pos_Y = 30;
            Slider.Width = 200;
            RhinoperspectiveView.AddControl(Slider);

    private void Button_Click(object sender, MouseEventArgs e)
    {
        MessageBox.Show("you clicked it?");

    }

Thank you @ChristopherBotha !

but a wrapper on the native Windows library is too complex for me.

jmv;