Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Update handler doesn't work for popup menus?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Update handler doesn't work for popup menus?

 Post Reply Post Reply
Author
Message
Howard Farseer View Drop Down
Groupie
Groupie


Joined: 30 September 2007
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Howard Farseer Quote  Post ReplyReply Direct Link To This Post Topic: Update handler doesn't work for popup menus?
    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?
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: 20 June 2008 at 2:11pm
Hi,
Check what hWnd parameter you use.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Howard Farseer View Drop Down
Groupie
Groupie


Joined: 30 September 2007
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Howard Farseer Quote  Post ReplyReply Direct Link To This Post 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);
...
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: 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
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.109 seconds.