Application caption doesn't update as expected in OnActiveProjectChanged event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wanted to display my current project name as part of the IV window caption. My addin works fine except when I change the project on the home screen by picking from the project list. The OnActiveProjectChanged event fires but the caption only updates if I include a messagebox as shown below or move the mouse up to the titlebar. If the messagebox line is removed the caption does not update until some other event occurs e.g. open part etc.
Private Sub m_appEvents_OnActiveProjectChanged(ByVal ProjectObject As Inventor.DesignProject, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_appEvents.OnActiveProjectChanged
If BeforeOrAfter = EventTimingEnum.kAfter Then
g_inventorApplication.Caption = "IV " & g_inventorApplication.SoftwareVersion.DisplayVersion & " (" & g_inventorApplication.DesignProjectManager.ActiveDesignProject.Name & ")"
MsgBox(g_inventorApplication.Caption)
End If
End Sub
If I change the project from the dropdown project dialog the caption updates as expected when the dialog is closed.
Does anyone have any idea how to force the caption change when choosing from the project list on the home screen? I have tried all the usual doevents, application update commands, toolbar redraws, ActiveView refresh etc but nothing has worked.
Any help appreciated.
Roger Mitchell