Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI elements with Eto #2545

Closed
WileyNg opened this issue Aug 26, 2023 · 1 comment
Closed

GUI elements with Eto #2545

WileyNg opened this issue Aug 26, 2023 · 1 comment

Comments

@WileyNg
Copy link

WileyNg commented Aug 26, 2023

Hi @cwensley

I have initiated a discussion in the forum here:
https://discourse.mcneel.com/t/custom-ui-elements-with-eto-forms/162955/21

Is there any possibility of receiving support for the Eto GUI elements?

Currently, we are employing a workaround to use a transparent Eto.Form by utilizing a WPF hack with styling, as shown below:

            Eto.Style.Add<Eto.Forms.Panel>(
            "transparent-form", control =>
            {
                var wpfwnd = (System.Windows.Window)control.ControlObject;
                wpfwnd.AllowsTransparency = true;

                wpfwnd.Background = swm.Brushes.Transparent;
                wpfwnd.Topmost = true;
                wpfwnd.ShowActivated = false;
                wpfwnd.WindowStyle = sw.WindowStyle.None;
            });

image
Since it's currently not possible to create a moduless form that can be attached to the viewport window at the moment, we are employing a convoluted way to hook the form to the viewport window.

        [DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
//hWndChild is created by the NativeHandle Property from each Control
//hWndNewParent is the active viewport window, found using the NativeHandle of the Rhino Application:
        [DllImport("user32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool EnumChildWindows(IntPtr window, EnumedWindow callback, ArrayList lParam);

Is there a better way to accomplish this? The current method lacks stability since the functionality is not integrated into the Eto library.

@cwensley
Copy link
Member

Hey @WileyNg, sorry for not responding earlier on this one. It would be really nice to have these features but the implementation of it (in the Rhino sense) is quite complicated as there are many different frameworks in play (native MFC, Cocoa, etc).

That being said, this issue combines two different problems into one so I've split it into #2746 and #2747 to have a clearer picture of what needs to be done.

Thank you again for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants