Problem while implementing tool tip in listctrl of report type.
Hi,
Below is my Code Code snippet wher I am facing problem.
every time "pNMHDR->idFrom" is returning 0.
I even put "EnableToolTips(TRUE);" in the oninitdialog method of dialog class.
BEGIN_MESSAGE_MAP(CMyListCtrl, ListCtrl)
.
.
.
ON_NOTIFY_EX(TTN_NEEDTEXTW, 0, OnToolTipText)
ON_NOTIFY_EX(TTN_NEEDTEXTA, 0, OnToolTipText)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
.
.
.
.
BOOL CMyListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
// need to handle both ANSI and UNICODE versions of the message
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
CString strTipText;
UINT nID = pNMHDR->idFrom;
if( nID == 0 ) // Notification in NT from automatically
return FALSE; // created tooltip
int row = ((nID-1) >> 10) & 0x3fffff ;
int col = (nID-1) & 0x3ff;
strTipText = GetItemText( row, col );
.
.
}
Please let me know what wrong I am doing. I am not able to get the text of a listctrl cell.
Re: Problem while implementing tool tip in listctrl of report type.
1. What ID do you expect to get?
2. Did you try to use LVS_EX_INFOTIP ext. style and handle LVN_GETINFOTIP notification?
3. Please, use Code tags while posting code snippets.
Re: Problem while implementing tool tip in listctrl of report type.
"Did you try to use LVS_EX_INFOTIP ext. style and handle LVN_GETINFOTIP notification"
No I have not implemented these. can you please provide any sample code/link for using these.
Thanks in Advance.
Re: Problem while implementing tool tip in listctrl of report type.