Print Page | Close Window

[SOLVED] HOWTO: Hide context menu items by actions

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13160
Printed Date: 19 May 2024 at 7:09pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] HOWTO: Hide context menu items by actions
Posted By: mgampi
Subject: [SOLVED] HOWTO: Hide context menu items by actions
Date Posted: 13 January 2009 at 11:11am
Hi;

I try to hide context menu items by commandbar actions but with no success.
I created a context menu in resource that has no according menu item in the main menu of the application. On right click inside the destination control I call AfxGetMainWnd()->GetCommandBars()->TrackPopupMenu(..., this)

On initialization of the main window I add all IDs of the menu items to be hidden later (regardless whether they are contained in the main menu or not) by calling GetCommandBars()->GetActions()->Add(ID).

When the context menu pops up all items are still visible.
I looked at the ActionsSample but this does not use TrackPopupMenu...

What do I have to do? Any ideas.


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Replies:
Posted By: mgampi
Date Posted: 15 January 2009 at 6:57am
Hi;
No idea? No one who had the same problem???


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: Oleg
Date Posted: 15 January 2009 at 7:07am
Hello,
 
Check if you call non static version of CommandBars::TrackPopupMenu.
 
try call TrackPopupMenuEx instead.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 15 January 2009 at 6:32pm
Thanks Oleg!

I already didn't call the static version of TrackPopupMenu but I forgot to provide the CommandBars object.
After changing all calls to TrackPopupMenuEx() it works as expected.

One last question:

I didn't implement commandbars customization yet, so I have to ask whether hidden actions can be switched back visible or not. The latter is preferred in my case!


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: Oleg
Date Posted: 16 January 2009 at 2:25am
Hi,
User can't switch it back in customization dialog. You have show them in code.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 16 January 2009 at 3:19am
That's exactly what I want!

Thanks


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net