1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
int CToolTipListCtrl::OnToolHitTest(CPoint point, TOOLINFO * pTI) const {
... (jamais appelée donc je ne précise pas le code)
}
BOOL CToolTipListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult ){
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
*pResult = 0;
CString strTipText;
//Get the mouse position
const MSG* pMessage;
pMessage = GetCurrentMessage();
ASSERT ( pMessage );
CPoint pt;
pt = pMessage->pt; //Get the point from the message
ScreenToClient( &pt ); //Convert the point's coords to be relative to this control
LVHITTESTINFO lvhitTestInfo;
lvhitTestInfo.pt = pt;
int nItem = SubItemHitTest(&lvhitTestInfo);
int nSubItem = lvhitTestInfo.iSubItem;
UINT nFlags = lvhitTestInfo.flags;
if( nFlags & m_wHitMask ){
CString strKey;
strKey.Format(_T("%d"), nItem * 100 + nSubItem);
if( m_ToolTipMap.Lookup(strKey, strTipText ) ){
_mbstowcsz(pTTTW->szText, strTipText, 80);
return FALSE;
}
}
return FALSE; //We didn't handle the message,
//let the framework continue propagating the message
} |
Partager