Disable UI for lengthy operations

Hello,
What is the best way to disable all UI input from the user?
Preferably, I’d like to know both how to prevent input while the screen gets redrawn and another without it being redrawn.
I was able to disable the main Rhino window using the window handle given by RhinoApp.MainWindowHandle() and the following p/invoke:

    [DllImport("user32.dll")]
    public static extern int SetWindowLongPtr(IntPtr hWnd, int nIndex, long dwNewLong);

But if the panels are floating the user can still use these panels.

I also tried to use the SetWindowLongPtr to disable the panel by passing the handle that I can get from the Handle parameter of the RhinoWindows.Controls.WpfElementHost subclass of my panel, but it doesn’t work.

Thank you

I also tried to get a list of Panels and setting the Enabled property to false. It does not work when the Panel is floating. Is this a bug?

Hi @scudelari,

One way is to run your calculation in a Rhino command.

– Dale