我有一个继承自CTreeCtrl
的类。在OnCreate()
函数中,我用自定义的CToolTipCtrl
对象替换了默认的对象:
int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTreeCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
// Replace tool tip with our own which will
// ask us for the text to display with a TTN_NEEDTEXT message
CTooltipManager::CreateToolTip(m_pToolTip, this, AFX_TOOLTIP_TYPE_DEFAULT);
m_pToolTip->AddTool(this, LPSTR_TEXTCALLBACK);
SetToolTips(m_pToolTip);
// Update: Added these two lines, which don't help either
m_pToolTip->Activate(TRUE);
EnableToolTips(TRUE);
return 0;
}
我的消息处理程序看起来像这样:
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, &CMyTreeCtrl::OnTtnNeedText)
然而我从未收到过TTN_NEEDTEXT
消息。我使用Spy++进行了查看,看起来这个消息确实没有被发送。
这里可能会有什么问题呢?
更新
我不确定这是否相关: CTreeCtrl
的父窗口属于CDockablePane
类型。 是否需要额外的工作才能使其正常工作?