Print Page | Close Window

Problems with context menu

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=207
Printed Date: 28 April 2024 at 5:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problems with context menu
Posted By: jamiei
Subject: Problems with context menu
Date 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!




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