Page 1 of 1

PDM add-in message box hiding behind transition progress window

Posted: Wed Mar 16, 2022 1:56 pm
by MMartens
I am writing a PDM add-in to catch when files finish going through a certain transition. Upon completion of the actions I am bring up a message box to notify the user of completion.

The issue I am having is the transition progress window is still showing when the msgbox opens causing the msgbox to be behind the transition progress window, barely visible.

The API help file https://help.solidworks.com/2021/Englis ... Redirect=1 is completely blank. Does anyone have any tricks for getting the msgbox to show in the foreground so it isn’t hidden?

Re: PDM add-in message box hiding behind transition progress window

Posted: Wed Mar 16, 2022 3:59 pm
by bnemec
Well, it's not completely blank, it says: "Search 'Keeping Add-in Windows in the Foreground' in the SOLIDWORKS Knowledge Base."
image.png
Which returns no results...

My inability to find stuff in the KB is so great that I cannot find something even if given the exact search string. So far, the only helpful KB solutions I've found are ones that some kind souls have provided the SPR numbers to.

Re: PDM add-in message box hiding behind transition progress window

Posted: Wed Mar 16, 2022 4:56 pm
by AlexB
I really don't know if it helps or not, but the window handle is given to you through the OnCmd function arguments. If you use poCmd.mlParentWnd to pass to your message box for the parent window, then it "hopefully" should work as intended. The only disclaimer I have is that I can't test this and it's fully possible it's just the window handle to the explorer window itself and not the popup loading prompt that is probably blocking your message box currently.

Re: PDM add-in message box hiding behind transition progress window

Posted: Thu Mar 17, 2022 8:39 am
by MMartens
I am using the window handle as an argument.

iVault.MsgBox(poCmd.mlParentWnd, message , EdmMBoxType.EdmMbt_OKOnly, Caption)

It would be nice if it functioned like Dispatch. In PDM Dispatch when running a post transition script, it actually waits for the transition progress window to close to fire the action. With my addin, it fires the action while the progress window is still open and the progress window doesn't close until after you dismiss the message box.

I'll keep searching.

Re: PDM add-in message box hiding behind transition progress window

Posted: Thu Mar 17, 2022 9:11 am
by AlexB
Yeah, I've noticed that with a few of my things too. It's not really useful to have a message pop up behind everything.

I don't know if it'd be possible to wait save your messages to be fired when EdmCmd_PostState is called. This doesn't really help if it's a yes/no dialog that determines how your add-in acts though. I don't like having to come up with hacks to get things to work the way they should have in the first place.

Re: PDM add-in message box hiding behind transition progress window

Posted: Fri Mar 18, 2022 9:20 am
by MMartens
For anyone looking for this same issue, my solution ended up being fairly simple. I created a simple userform with a label for my message and an OK button. Before using the Show method, I the TopMost property to True. Now my userform opens on top of the transition progress window.

Dim window = New MyUserform
With window
.TopMost = True
.Label1.Text = "My message here"
.ShowDialog(iVault.GetWin32Window(poCmd.mlParentWnd))
End With