Rhino 8 - Modal Dialogs Issue

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:
Rhino8ModalFocusIssue

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?

Hi Jason - programing is way above my paygrade and competence - I’ll see if I can get someone’s attention…

@dale - can you help?

-Pascal

1 Like

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.

var rhinoWindowHandle = Rhino.RhinoApp.MainWindowHandle();
 Win32APIHelper.RemoveBordersAndFrame(rhinoWindowHandle);
 Win32APIHelper.ReparentWindow(rhinoWindowHandle, parentHandle);
 Win32APIHelper.SetWindowAsChild(rhinoWindowHandle, parentHandle, 0, 0, 800, 600);

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

but I guess you have probably already tried this

1 Like

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!

1 Like

@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.

SampleFocusIssuePlugin.7z (130.5 KB)

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.

Click the buttons 1-4 to see the issue.

And here is a video demoing the solution:

2 Likes

Hi @jstevenson,

Just a quick note to let you know I’ve seen this and will investigate.

– Dale

1 Like

RH-84865 is fixed in Rhino 8 Service Release 14

Happy Thanksgiving @dale,

Looks like your changes fixed our issues with being unable to resize the toolbars or the command prompt. Unfortunately now the dialogs for commands like Sweep2 no longer show up at all.

I can see the command is expecting the dialog to be visible, but is isn’t anywhere to be seen. This doesn’t seem to be related to being parented, because I had special code that makes the desktop the Rhino processes parent.

If I use Rhino by itself of course this issue doesn’t happen. We are really stuck here, because now you can no longer Add Slash or manipulate the options in Sweep 2.

Interestingly enough the Quad Remesh dialog does show up, even though it was another of the commands that we had issues because of our reparenting, but you still cannot interact with the viewport still while it’s dialog is open unless we unparent the window.

I’m hoping you have some more ideas. At this point, the cure might have been worse that the disease, unless there are multiple commits affecting these issues.

Hi @jstevenson,

Your SampleFocusIssuePlugin works nicely here, including the Sweep2 test.

Can you test this plug-in to make sure I’m not crazy?

– Dale

1 Like

Good Morning @dale,

I’m sorry if I mislead you, after further investigation, it appears as though Sweep2 is now fixed. Looks like Rhino had remembered where that dialog window was last shown, and it was in a location on another monitor that wasn’t currently active on my system. The monitor has 2 inputs, and it was connected to another laptop at the time of testing.

I do still however have an issue with focus specifically with the QuadRemesh and 7 other commands. I’ve retested our list of commands that were known to have these issues. Here is the updated list of commands that continue to have this issue, I assume they use a different set of dialog logic than the now fixed Sweep2 command.

When a command isn’t allowing focus to the viewport, it’s dialog shows a Rhino Icon, while the command dialogs that you fixed are showing our application icon:
image image

Previously had focus issues, these can now be used while dialog open:
Loft, Rebuild, Sweep1, Sweep2, NetworkSrf, Patch, Heightfield, MatchSrf

These commands continue to not allow interacting with the viewport while their dialogs are displayed:
Make2d, QuadRemesh, RibbonOffset, ShrinkWrap, SubDLoft, SubDSweep1, SubDSweep2, Vectorize

So I cannot remove all of our unparent logic yet, but Sweep2 and other above commands are now off our naughty list. I hope this can give you an idea of where to look next. The remaining commands with dialog issues are likely setting their dialog parent differently than the now working commands.

Thank you for fixing those 8 commands, just 8 more and we can delete a whole bunch of hacky code.

Thank you so much for spending time on this, I know this isn’t your core usage for Rhino, but we appreciate you digging into this for us.

– Jason

Can you change the visibility of this work item to public?

Accessible now.

1 Like

I see that the issue is marked closed, but it is still happening on the other commands I mentioned two comments above. Can you ask @dale to re-open it, or create a new work item for these remaining commands?

Thank you sir!

Jason

Hi @jstevenson,

I’ve opened a new issue for the .NET specific dialog issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-85097

– Dale

1 Like

Any chance of a Christmas Miracle for this one @curtisw ?

Any chance we can get some help on this before end of January? We release v1 of our software at end of January, would be great if we could resolve this last issue with our Rhino 8 users.

@dale @curtisw @Trav @Matt_Bennett We will be releasing our v1 of JewelBeetle in about 13 days, I would really like to be able to resolve this last issue with our Rhino 8 users.

Would anyone be able to look at RH-85097 soon?

Thank you for you for any help you can provide.

Jason