Handle Home/Tutorials tab activation

Handle Home/Tutorials tab activation

Maxim-CADman77
Advisor Advisor
681 Views
6 Replies
Message 1 of 7

Handle Home/Tutorials tab activation

Maxim-CADman77
Advisor
Advisor

I'd like to know whether it possible (and how if 'yes') to detect/handle activation of non-document tab ('Home' or 'Tutorials')?

MaximCADman77_0-1702313735558.png

 

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Accepted solutions (1)
682 Views
6 Replies
Replies (6)
Message 2 of 7

Frederick_Law
Mentor
Mentor

Try "UserInterfaceManager":

https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-AF3FE38F-CCE3-428B-A51A-09697BBC24FB

 

I was using Browserpane and DockableWindows.  Didn't see "Home" in them.

Message 3 of 7

Maxim-CADman77
Advisor
Advisor

Seems like I need to handle the UserInterfaceEvents.OnEnvironmentChange Event 

I've tried the VB.Net code:

 

Private Sub UiEvents_OnEnvironmentChange(Environment As Environment, EnvironmentState As EnvironmentStateEnum, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum) Handles UiEvents.OnEnvironmentChange
      MessageBox.Show("!!!")
End Sub

 

(this is just copy-paste from the help)

 

But Visual Studio (2022 Community) refuses to compile it with Error BC31029
Method 'UiEvents_OnEnvironmentChange' cannot handle event 'OnEnvironmentChange' because they do not have a compatible signature.

 

What I'm missing?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 4 of 7

Frederick_Law
Mentor
Mentor

Do you have this?

#Region "Data"
    Private WithEvents UiEvents As UserInterfaceEvents
#End Region

 

Actually, what are you trying to do?

Prevent Home and Tutorial from running?

An addin/iLogic can turn off the commands.

Tutorial is addin you can turn off.

 

Close them when the tabs are there?

Message 5 of 7

Maxim-CADman77
Advisor
Advisor

Yes - UiEvents is declared.
I'm developing the AddIns that has a widget which is supposed to be hidden as soon as  Graphics Window stops showing any document.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 6 of 7

Frederick_Law
Mentor
Mentor
Accepted solution

Found it, ByRef:

Private Sub UiEvents_OnEnvironmentChange(Environment As Environment, EnvironmentState As EnvironmentStateEnum, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles UiEvents.OnEnvironmentChange
      MessageBox.Show("!!!")
End Sub

 

 

Message 7 of 7

Maxim-CADman77
Advisor
Advisor

Yeh, I should have notice the HandlingCode argument is 'Output'. Thank you!


Now the code compiles, but for some reason I can't get the Sub to run (even so EventWatcher* catches the event on switching from document tab to Home or Tutorials and on opposite switch):

MaximCADman77_0-1702332338599.png

Again I'm missing something.

 

UPDATE:

Another necessary line was for some reason absent in my project:

 

UiEvents = invApp.UserInterfaceManager.UserInterfaceEvents()

 

 

*
The util from Inventor SDK DevTools.

 

Please vote for Inventor-Idea Text Search within Option Names

0 Likes