Не удается заставить OnContextMenu работать с настраиваемым классом CListCtl

Я пытаюсь заставить контекстное меню работать для производного класса CListCtrl. Я только что создал метод OnContextMenu, но он не вызывается. Что мне не хватает? Я использую Visual Studio 2008 для создания приложения MFC на основе CDialog.

CustomList.h

class tcCustomListCtl : public CListCtl
{
    DECLARE_DYNAMIC(tcCustomListCtl)

public:
    tcCustomListCtl();
    virtual ~tcCustomListCtl();

protected:
    DECLARE_MESSAGE_MAP()

    afx_msg void OnContextMenu(CWnd* pWnd,CPoint pos );
};

CustomList.cpp

// tcFaultListCtl
IMPLEMENT_DYNAMIC(tcCustomListCtl, CListCtrl)

tcCustomListCtl::tcCustomListCtl()
{
}

tcCustomListCtl::~tcCustomListCtl()
{
}

BEGIN_MESSAGE_MAP(tcCustomListCtl, CListCtrl)
END_MESSAGE_MAP()

// tcCustomListCtl message handlers
afx_msg void tcCustomListCtl::OnContextMenu(CWnd* pWnd,CPoint pos )
{
  TRACE("tcCustomListCtl::OnContextMenu\n");
}

person CptanPanic    schedule 05.02.2010    source источник


Ответы (1)


Я обнаружил, что мне нужно добавить ON_WM_CONTEXTMENU () в карту сообщений.

person CptanPanic    schedule 05.02.2010