Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add a "PopupButton" in OnLinearMarkingMenu

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Rene_Gerlach
1180 Views, 8 Replies

How to add a "PopupButton" in OnLinearMarkingMenu

Hello,

 

I try to add a popup-menu to the LinearMarkingMenu without success:

 

HRESULT EventClass::OnLinearMarkingMenu( struct Inv::ObjectsEnumerator * SelectedEntities,
                                                                    enum Inv::SelectionDeviceEnum SelectionDevice,
                                                                    struct Inv::CommandControls * LinearMenu,
                                                                    struct Inv::NameValueMap * AdditionalInfo )

{

if (Inv::kBrowserSelection != SelectionDevice) // add this only at browser window

{
  return S_FALSE;
}

 

Inv::CommandControlPtr pCC;
Inv::ObjectCollectionPtr pObjectCollection;
Inv::TransientObjectsPtr pTransientObjects;
hr = m_pApplication->get_TransientObjects(&pTransientObjects);
if (S_OK == hr && NULL != pTransientObjects)
{
  hr = pTransientObjects->CreateObjectCollection(_variant_t(), &pObjectCollection);

  hr = pObjectCollection->Add(pEditCmd); // pEditCmd is a Inv::ButtonDefinitionObjectPtr, it is a valid object, checked before

  // if I try this

  hr = LinearMenu->AddPopup(pBDO, pObjectCollection, VARIANT_FALSE, VARIANT_TRUE, _bstr_t(L""), VARIANT_FALSE, &pCC);

  // i get hr == E_FAIL

 

   hr = LinearMenu->AddButton(pBDO, VARIANT_FALSE, VARIANT_TRUE, _bstr_t(L""), VARIANT_FALSE, &pCC); // <- this works 

   // if I try to get the child controls, to add a button

   // Inv::CommandControlsPtr pCCs;
   // hr = pCC->get_ChildControls(&pCCs);

   // hr == S_OK but pCCs == NULL

 

So what can I do to add a PopupMenu in this situation?

Or what I'm doing wrong?

 

Win7x64

Inventor2014SP2

8 REPLIES 8
Message 2 of 9
adam.nagy
in reply to: Rene_Gerlach

Hi Rene,

 

<sigh>

I'm double checking with others but it does look like an issue 😞

 

I'll get back to you.

 

Cheers,

 



Adam Nagy
Autodesk Platform Services
Message 3 of 9
adam.nagy
in reply to: adam.nagy

Others agree, so have logged it in our system: CR 1518148

 

Sorry about the inconvenience it causes 😞



Adam Nagy
Autodesk Platform Services
Message 4 of 9
Rene_Gerlach
in reply to: adam.nagy

Thanks Adam

 

Cheers

René

Message 5 of 9
Anonymous
in reply to: Rene_Gerlach

Hello Rene,

 

I too am trying to do some thing similar in Inventor 2014.

Adding a custom flyout menu similar to the Measure menu seen in the RMB action.

 

I too will be interested in if a solution is provided by Autodesk.

 

Regards,

Aditya

Message 6 of 9
jan.pomplun
in reply to: adam.nagy

Hi,

 

I am using Inventor 2018 and the problem still exists! I can not add a split button to a linear context menu.

Does autodesk have the intention to fix the problem ever??

It has been reported almost 4 years ago and no workaround exists!

 

Best,

 

Jan

Message 7 of 9
adam.nagy
in reply to: jan.pomplun

Hi Jan,

 

Turns out it's not an issue with the API, but it's a functionality that is simply not available in Inventor - i.e. Inventor does not create such menu items either.

 

To check how much support this feature has in the community the best thing is to log it on the Inventor IdeaStation:

http://modthemachine.typepad.com/my_weblog/2015/07/tracking-api-wishes.html 

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 8 of 9
jan.pomplun
in reply to: adam.nagy

Dear Adam,

 

thanks for the reply. Please see the picture in the original question in following post:

 

https://forums.autodesk.com/t5/inventor-customization/submenu-in-linear-marking-menu/m-p/7984381#M84...

 

grafik.png

there you see an entry in the context menu with black arrow opening a sub menu. This is what I want to do programmatically, but still can not get it to work. Adding a split button to the robbons works, adding it to the linear menu throws an exception.

I have been pointed to the context menu. Do you know what is the difference between context menu and linear menu?

        private UserInputEvents mEventsObj;
            mEventsObj.OnContextMenu += UserInputEvents_OnContextMenu_Handler;
            mEventsObj.OnLinearMarkingMenu += UserInputEvents_OnLinearMarkingMenu_Handler;

Both are fired at right click.

 

Best,

 

Jan

Message 9 of 9
adam.nagy
in reply to: jan.pomplun

This is the feedback I got:

"It is not implemented to add pop up button in linear Marking Menu directly, so currently users can use the legacy API to add the pop up buttons in the context menu as a workaround.

 

The marking menu was introduced into Inventor to provide a new and enhanced style context menu against the legacy one, when users set the context menu using the legacy API, then the marking menu will pick up the context menu buttons to linear marking menu, so that is why currently users can still use the legacy context menu as workaround. The marking menu supports mouse gesture (i.e. you right click mouse and hole down and drag the cursor in the direction of the button in the radial marking menu) which provides more quick operation."

 

So it sounds like you could use the legacy Context Menu API to achieve what you want.

 

Cheers,



Adam Nagy
Autodesk Platform Services

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

Post to forums  

Autodesk Design & Make Report