In Rhino 7 our application (JewelBeetle) was able to interact with both the Viewports and a Command Dialog such as Sweep 2 Rail Options dialog. While the command is running, the dialog although appears modal, still allowed you to interact with the Viewport.
In Rhino 8 we just get the windows error sound, as if the viewports are from another application, and so you cannot interact with them, while the dialog box is open. This breaks a lot of commands that use Rhino Dialogs while running.
I hope someone has an idea on this issue, I’ve been working for two days for a solution and so far I’ve had no luck.
Background: We REPARENT the Rhino Window inside of our WPF Window. This is necessary for completeness of our custom UI. If I remove the Reparent logic, and allow Rhino to remain a free floating separate window, the issue doesn’t happen.
I’m just hoping there is a simple obvious solution from someone. Any thoughts on this @stevebaer@dale@Trav@menno ?
Here is a quick visual of Rhino 8 on the left, and Rhino 7 on the right:
I would really appreciate any help, anyone can be here. We are pretty stumped. Does anyone else have any similar issue?
@pascal do you have any ideas with these popups from a running command? I’ve checked the window styles and it seems like they didn’t change going from R7 to R8. But for some reason they are acting more modal than in R7?
I’ve done more digging and it seems that when I watch the Rhino Window for Window Messages, in Rhino 7, after that Dialog for Sweep2 is shown, window messages continue to pump into the Rhino window.
But in Rhino 8, as soon as the dialog for Sweep2 is shown, window messages are not getting to the Rhino Window.
I’ve looked at our code and there is no difference between our Rhino 7 vs. Rhino 8 version of logic.
The only thing currently that fixes the issue is to not reparent the Rhino Window, but we have to in order for it to live inside of our UI.
Hope this context helps spark a solution, and maybe see if there is some window message forwarding that used to be there in 7 that isn’t in 8 maybe? Or isn’t if it isnt the top level window in 8.
I’m not sure if there are any pinvoke Gods at McNeel, but in case this helps. Here is a sample of the code we are doing to reparent the Rhino Window inside of our UI, that worked fine in Rhino 7, but now in Rhino 8 these dialogs that popup during for instance the Sweep2 command, prevent the Rhino Windows from getting the messages from the mouse.
The attached file was generated by ChatGPT to avoid giving away any of our actual code, but it does essentially do the same work we do in our code. Win32APIHelper.cs (3.6 KB)
Do you guys have any idea if those dialogs have a custom window message loop that is different in Rhino 8 that is affected by the owner of the Rhino Window? That didn’t affect Rhino 7?
@dale can you tag someone on your team that may have any ideas?
all I notice without setting up a test project is that the SetParent docs say to clear WS_POPUP and set WS_CHILD before calling SetParent, if hWndNewParent is non-NULL and currently a child of the desktop; it also says to synchronize UISTATE
Thanks for responding Jeremy. I’ll give that a shot. My SetWindowAsChild() is that, and so if I push the ReparentWindow() call to the end, it doesn’t change the behavior.
So alas, the problem still exists. Thanks for trying buddy!
@pascal@dale I created an entire new solution, with the minimum code, demonstrating the issue we are having. I hope this can help someone there track down what is different in Rhino 8 that we need to code differently to handle.
The solution has everything needed with 4 easy steps to reproduce the issue.
This is a .Net 4.8 WPF General Utility Plugin that demonstrates the issue. It has everything needed to see the issue we are experiencing. Just run the solution, execute the SampleFocusIssueCommand and it will open the main window of the plugin.