Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - [SOLVED] HOWTO: Hide context menu items by actions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] HOWTO: Hide context menu items by actions

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] HOWTO: Hide context menu items by actions
    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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.