Disable button on ribbon in addin using API C#

Disable button on ribbon in addin using API C#

gert-leonvanlier
Collaborator Collaborator
867 Views
1 Reply
Message 1 of 2

Disable button on ribbon in addin using API C#

gert-leonvanlier
Collaborator
Collaborator

I am looking for a way to disable and enable a button on the ribbon from my addin in Inventor (2019). Meaning: the button should still be visible, but can not be clicked. I found how to have the button visible or not, but it would be better if the button is greyed out.

 

UserInterfaceManager userInterfaceManager = Globals.invApp.UserInterfaceManager;
Ribbon drawingRibbon = userInterfaceManager.Ribbons["Drawing"];
RibbonTab ribbonTab = drawingRibbon.RibbonTabs["tab_dwg"];
RibbonPanel ribbonPanel = ribbonTab.RibbonPanels["Drawing_panel_dwg"];
ribbonPanel.CommandControls["Button_internal_name"].Visible = false;
0 Likes
Accepted solutions (1)
868 Views
1 Reply
Reply (1)
Message 2 of 2

gert-leonvanlier
Collaborator
Collaborator
Accepted solution

As always, just after posting I found what I needed:

 

UserInterfaceManager userInterfaceManager = Globals.invApp.UserInterfaceManager;
Ribbon drawingRibbon = userInterfaceManager.Ribbons["Drawing"];
RibbonTab ribbonTab = drawingRibbon.RibbonTabs["tab_dwg"];
RibbonPanel ribbonPanel = ribbonTab.RibbonPanels["Drawing_panel_dwg"];
ribbonPanel.CommandControls["Button_internal_name"].ControlDefinition.Enabled = false;

 

0 Likes