PDM add-in message box hiding behind transition progress window

Installation, PDM, standards, training, support, part numbering, rev schemes, etc.
MMartens
Posts: 36
Joined: Wed Apr 28, 2021 10:01 am
Answers: 6
Location: Shawano, WI USA
x 6

PDM add-in message box hiding behind transition progress window

Unread post 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?
by MMartens » Fri Mar 18, 2022 9:20 am
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
Go to full post
User avatar
bnemec
Posts: 1941
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2540
x 1398

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

Unread post 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.
User avatar
AlexB
Posts: 493
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 27
x 265
x 440

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

Unread post 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.
MMartens
Posts: 36
Joined: Wed Apr 28, 2021 10:01 am
Answers: 6
Location: Shawano, WI USA
x 6

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

Unread post 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.
User avatar
AlexB
Posts: 493
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 27
x 265
x 440

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

Unread post 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.
MMartens
Posts: 36
Joined: Wed Apr 28, 2021 10:01 am
Answers: 6
Location: Shawano, WI USA
x 6

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

Unread post 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
Post Reply