Print Page | Close Window

Update handler doesn't work for popup menus?

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=11131
Printed Date: 01 March 2025 at 3:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Update handler doesn't work for popup menus?
Posted By: Howard Farseer
Subject: Update handler doesn't work for popup menus?
Date Posted: 20 June 2008 at 2:03pm
I created a popup menu by loading from resource when right-click at dockpane, but it doesn't change its state like enable/disabled. i'v already immplemented ON_UPDATE_COMMAND_UI for that same item ID and it works for toolbar popup menu. I dont want to append menu one by one but to load menu from resource. Any body knows that?



Replies:
Posted By: Oleg
Date Posted: 20 June 2008 at 2:11pm
Hi,
Check what hWnd parameter you use.


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


Posted By: Howard Farseer
Date Posted: 21 June 2008 at 2:17pm
Hi, here's my code
 
void CTodoListView::OnRightClickList(NMHDR* pNMHDR, LRESULT* pResult)
{
 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
 const int nRow = pNMListView->iItem;
 const int nCol = pNMListView->iSubItem;
 int ret = 0;
 POINT point = pNMListView->ptAction;
 if (nRow != -1 && m_wndTodoList.GetItemState(nRow,LVIS_SELECTED) == LVIS_SELECTED)
 {
  CMenu menu;
//  ClientToScreen(&point);
  GetCursorPos(&point);
  VERIFY(menu.LoadMenu(IDR_TODOLIST));
  CMenu* pPopup = menu.GetSubMenu(1);
  ASSERT(pPopup != NULL);
/*
  CShellContextMenus scm;
  CStringArray saFilesSel;
  m_wndTodoList.GetAllSelectedPaths(saFilesSel);
  scm.SetObjects(saFilesSel); 
  UINT idCommand = scm.ShowContextMenu(this, point);*/
//  pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
  XTFuncContextMenu(pPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this, IDR_TOOLBAR_TODOLIST);
...


Posted By: Oleg
Date Posted: 22 June 2008 at 2:35am
Hi,
if you use "this" Update handler have to be in CTodoListView.
 
Instead "this" try "AfxGetMainWnd()"


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



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