ObjectARX

ObjectARX

Reply
Active Member
eran
Posts: 6
Registered: ‎02-05-2006
Message 1 of 2 (1,069 Views)

ObjectArx 2010 Menu Bar - MFC

1069 Views, 1 Replies
04-19-2010 09:33 AM
Hello All!

I am using a class from ObjectARx 2010 sample kit(AsdkMfcComSamp_dg) code called CAcadPopupMenus to add a pop menu to the menu bar. This class is great and gives me the functionality I need but I am wondering about two things:

1.How can I disable menu items?
2.How can I hide(not remove) menu items?

One more way I tried adding a menu is by using class AdMenuBar. This was also unsuccessful:

AdApplicationFrame* pApplication = acedGetApplicationFrame();
AdMenuBar* pACMenuBar = pApplication->GetMenuBar();
HMENU hMenuBar = pACMenuBar->GetMenuHandle();
CMenu* pMfcMenu = new CMenu;
pMfcMenu->Attach(hMenuBar);
pMfcMenu->CreatePopupMenu();

pMfcMenu->AppendMenu(MF_STRING | MF_ENABLED | MF_BYCOMMAND, IDM_SOLIDACM_START, solidcam_start_menu);
pMfcMenu->AppendMenu(MF_STRING | MF_GRAYED | MF_BYCOMMAND, IDM_SOLIDACM_END , solidcam_end_menu );
pMfcMenu->AppendMenu(MF_POPUP, (UINT) (HMENU) *pMfcMenu, solidcam_menu);

pACMenuBar->UpdateMenu();

This is one way I tried which did not work out. Should I use AdMenuBar->AddMenuItem? I tried but it also unsuccsessful. Maybe I am doing something wrong:

AdApplicationFrame* pApplication = acedGetApplicationFrame();
AdMenuBar* pACMenuBar = pApplication->GetMenuBar();
HMENU hMenuBar = pACMenuBar->GetMenuHandle();
CMenu* pMfcMenu = new CMenu;
pMfcMenu->CreatePopupMenu();

MENUITEMINFO MenuItemInfo;

pMfcMenu->AppendMenu(MF_STRING | MF_ENABLED | MF_BYCOMMAND, IDM_SOLIDACM_START, solidcam_start_menu);
pMfcMenu->AppendMenu(MF_STRING | MF_GRAYED | MF_BYCOMMAND, IDM_SOLIDACM_END , solidcam_end_menu );

pMfcMenu->AppendMenu(MF_POPUP, (UINT) (HMENU) *pMfcMenu, solidcam_menu);
pACMenuBar->AddMenuItem(pMfcMenu->GetSafeHmenu(), //HMENU hMenu);
5, //UINT nPos - Random
MenuItemInfo, //const MENUITEMINFO& menuItem Empty - Problem?
NULL, // LPFNADMENUCALLBACK pfnCallback - Not sure what to put here
_T("Menu Test") //const wchar_t *wszHelpString - For Doc??
);

AddMenuItem returns 0. I am pretty sure I am doing something wrong but I am not sure...

Any help would be extremely appreciated!

Thanks!
David Somekh
Software Engineer
david.somekh@solidcam.com
*Alexander Rivilis
Message 2 of 2 (1,069 Views)

Re: ObjectArx 2010 Menu Bar - MFC

04-20-2010 02:01 AM in reply to: eran
Hi, eran!

e> I am using a class from ObjectARx 2010 sample kit(AsdkMfcComSamp_dg) code
e> called CAcadPopupMenus to add a pop menu to the menu bar. This class is
e> great and gives me the functionality I need but I am wondering about two
e> things:
e> 1.How can I disable menu items?

You can use PopupMenuItem.Enable(FALSE) method.
Look at AutoCAD 2010 Help->Developer Help->ActiveX and VBA Reference->Objects->PopupMenuItem object
Enable property example

e> 2.How can I hide(not remove) menu items?

As I know it is impossible hide menu item without removing it.

Best Regards,
Alexander Rivilis.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.