Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Problems with context menu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problems with context menu

 Post Reply Post Reply
Author
Message
jamiei View Drop Down
Newbie
Newbie


Joined: 01 November 2003
Location: United Kingdom
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamiei Quote  Post ReplyReply Direct Link To This Post Topic: Problems with context menu
    Posted: 02 November 2003 at 4:13pm

I've created a CTreeView derived class that is then attached to a docking pane using AttachView. Inside this derived class I've overridden the OnContextMenu method where I want to display a context menu.

The code that does this is as follows:

 

CMenu menu;

menu.LoadMenu( IDR_MAINFRAME );

CMenu* pMenu = menu.GetSubMenu(0);

CXTPPopupBar popup;

popup.LoadMenu( pMenu );

popup.Popup( point.x, point.y, 0 );

 

For some reason, this only seems to be called if I double click on the view. For example, if I just right click once in the tree control's area I get nothing, if I double click then a menu is displayed before being destroyed straight away. I added a call to MessageBox just to block the code and the menu does appear, but as I said, as soon as the code continues the menu is destroyed.

I've not found anything about using the pop-up menus (yet) so it's possible I've used the classes in the wrong way. However, what is slightly weirder is the fact I need to double click to get it displayed.

If anyone can shed any light I'd be very grateful. I've so far found using/creating the docking panes fairly problematic!

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.141 seconds.