Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disabling/enabling of control definition not working

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
prakash.muthu
218 Views, 2 Replies

Disabling/enabling of control definition not working

Hi,

In our addon (developed in c++), trying to disable/enable few control definitions and works for most of controls. Disabling of control definition - "MoldCreateMoldDesign" is not working and remain enabled in ribbon.
Display name in ribbon: Create Mold Design in Environment menu.

Executing below code in document activate event.

c++ code:
CComPtr<CommandManager> pCommandManager;
HRESULT hr = pApplication->get_CommandManager(&pCommandManager);
ControlDefinitionsPtr defs = pCommandManager->GetControlDefinitions();

long defCount = 1;
CComPtr<ControlDefinition> pDef;
//Iterate through the controls
for (; (hr = defs->get_Item(CComVariant(defCount), &pDef)) == S_OK; pDef.Release())
{
++defCount;
std::wstring iname = pDef->GetInternalName();
if (iname == L"MoldCreateMoldDesign")
{
pDef->put_Enabled(VARIANT_FALSE);
break;
}
}

 

 

Also checked in vba code and disabling properly.
vba code:
Sub DiableCommandName()
Dim oCommandMgr As CommandManager
Set oCommandMgr = ThisApplication.CommandManager

Dim oControlDefs As ControlDefinitions
Set oControlDefs = oCommandMgr.ControlDefinitions

Dim oControlDef As ControlDefinition

'Iterate through the controls.
For Each oControlDef In oControlDefs
If oControlDef.InternalName = "MoldCreateMoldDesign" Then
oControlDef.Enabled = False
End If
Next
End Sub


Why same logic not working in c++ addon?
what is the solution to disable/enable "MoldCreateMoldDesign" control?.

Tags (1)
2 REPLIES 2
Message 2 of 3
talife4725
in reply to: prakash.muthu

Hey,

might wanna post this in the correct section. 
You'll get way more answers in Inventor iLogic and VB.net Forum

 

Message 3 of 3
prakash.muthu
in reply to: talife4725

Thank you. Posted in Inventor iLogic and VB.net Forum.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report