@@ -123,27 +123,35 @@ bool CListEx::Create(const LISTEXCREATESTRUCT& lcs)
123
123
if (!m_stWndTtCell.CreateEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr , TTS_BALLOON | TTS_NOANIMATE | TTS_NOFADE | TTS_NOPREFIX | TTS_ALWAYSTIP,
124
124
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr , nullptr ))
125
125
return false ;
126
-
127
126
SetWindowTheme (m_stWndTtCell, nullptr , L" " ); // To prevent Windows from changing theme of Balloon window.
128
-
129
127
m_stTInfoCell.cbSize = TTTOOLINFOW_V1_SIZE;
130
128
m_stTInfoCell.uFlags = TTF_TRACK;
131
- m_stTInfoCell.uId = 0x1 ;
129
+ m_stTInfoCell.uId = 0x01 ;
132
130
m_stWndTtCell.SendMessageW (TTM_ADDTOOL, 0 , reinterpret_cast <LPARAM>(&m_stTInfoCell));
133
131
m_stWndTtCell.SendMessageW (TTM_SETMAXTIPWIDTH, 0 , static_cast <LPARAM>(400 )); // to allow use of newline \n.
134
132
m_stWndTtCell.SendMessageW (TTM_SETTIPTEXTCOLOR, static_cast <WPARAM>(m_stColors.clrTooltipText ), 0 );
135
133
m_stWndTtCell.SendMessageW (TTM_SETTIPBKCOLOR, static_cast <WPARAM>(m_stColors.clrTooltipBk ), 0 );
136
134
137
- if (!m_stWndTtLink.CreateEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr , TTS_NOANIMATE | TTS_NOFADE | TTS_NOPREFIX | TTS_ALWAYSTIP,
135
+ if (!m_stWndTtLink.CreateEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr , TTS_NOPREFIX | TTS_ALWAYSTIP,
138
136
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr , nullptr ))
139
137
return false ;
140
-
141
138
m_stTInfoLink.cbSize = TTTOOLINFOW_V1_SIZE;
142
139
m_stTInfoLink.uFlags = TTF_TRACK;
143
- m_stTInfoLink.uId = 0x2 ;
140
+ m_stTInfoLink.uId = 0x02 ;
144
141
m_stWndTtLink.SendMessageW (TTM_ADDTOOL, 0 , reinterpret_cast <LPARAM>(&m_stTInfoLink));
145
142
m_stWndTtLink.SendMessageW (TTM_SETMAXTIPWIDTH, 0 , static_cast <LPARAM>(400 )); // to allow use of newline \n.
146
143
144
+ if (m_fHighLatency) // Tooltip for HighLatency mode.
145
+ {
146
+ if (!m_stWndTtRow.CreateEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr , TTS_NOANIMATE | TTS_NOFADE | TTS_NOPREFIX | TTS_ALWAYSTIP,
147
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, m_hWnd, nullptr ))
148
+ return false ;
149
+ m_stToolInfoRow.cbSize = TTTOOLINFOW_V1_SIZE;
150
+ m_stToolInfoRow.uFlags = TTF_TRACK;
151
+ m_stToolInfoRow.uId = 0x03 ;
152
+ m_stWndTtRow.SendMessageW (TTM_ADDTOOL, 0 , reinterpret_cast <LPARAM>(&m_stToolInfoRow));
153
+ }
154
+
147
155
m_dwGridWidth = lcs.dwListGridWidth ;
148
156
149
157
LOGFONTW lf;
@@ -957,6 +965,22 @@ void CListEx::TtCellHide()
957
965
KillTimer (ID_TIMER_TT_CELL_CHECK);
958
966
}
959
967
968
+ void CListEx::TtRowShow (bool fShow , UINT uRow)
969
+ {
970
+ if (fShow )
971
+ {
972
+ CPoint ptScreen;
973
+ GetCursorPos (&ptScreen);
974
+
975
+ static wchar_t warrOffset[32 ] { L" Row: " };
976
+ swprintf_s (&warrOffset[5 ], 24 , L" %u" , uRow);
977
+ m_stToolInfoRow.lpszText = warrOffset;
978
+ m_stWndTtRow.SendMessageW (TTM_TRACKPOSITION, 0 , static_cast <LPARAM>(MAKELONG (ptScreen.x - 5 , ptScreen.y - 20 )));
979
+ m_stWndTtRow.SendMessageW (TTM_UPDATETIPTEXT, 0 , reinterpret_cast <LPARAM>(&m_stToolInfoRow));
980
+ }
981
+ m_stWndTtRow.SendMessageW (TTM_TRACKACTIVATE, static_cast <WPARAM>(fShow ), reinterpret_cast <LPARAM>(&m_stToolInfoRow));
982
+ }
983
+
960
984
void CListEx::MeasureItem (LPMEASUREITEMSTRUCT lpMIS)
961
985
{
962
986
// Set row height according to current font's height.
@@ -1298,7 +1322,7 @@ void CListEx::OnPaint()
1298
1322
DefWindowProcW (WM_PAINT, reinterpret_cast <WPARAM>(rDC.m_hDC ), static_cast <LPARAM>(0 ));
1299
1323
}
1300
1324
1301
- void CListEx::OnVScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
1325
+ void CListEx::OnVScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
1302
1326
{
1303
1327
if (m_fVirtual && m_fHighLatency)
1304
1328
{
@@ -1317,6 +1341,7 @@ void CListEx::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
1317
1341
Scroll (size);
1318
1342
flag = false ;
1319
1343
}
1344
+ TtRowShow (false , 0 );
1320
1345
CMFCListCtrl::OnVScroll (nSBCode, nPos, pScrollBar);
1321
1346
}
1322
1347
else
@@ -1327,6 +1352,7 @@ void CListEx::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
1327
1352
si.fMask = SIF_ALL;
1328
1353
GetScrollInfo (SB_VERT, &si);
1329
1354
uItem = si.nTrackPos ; // si.nTrackPos is in fact a row number.
1355
+ TtRowShow (true , uItem);
1330
1356
}
1331
1357
}
1332
1358
else
@@ -1374,8 +1400,8 @@ BOOL CListEx::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT * pResult)
1374
1400
void CListEx::OnLvnColumnClick (NMHDR* /* pNMHDR*/ , LRESULT* /* pResult*/ )
1375
1401
{
1376
1402
/* ******************************************************************************
1377
- * Just an empty handler.
1378
- * Without it all works fine, but assert triggers in Debug mode, when clicking
1403
+ * Just an empty handler.
1404
+ * Without it all works fine, but assert triggers in Debug mode, when clicking
1379
1405
* on header, if list is in Virtual mode (LVS_OWNERDATA).
1380
1406
* ASSERT((GetStyle() & LVS_OWNERDATA)==0)
1381
1407
*******************************************************************************/
@@ -1401,6 +1427,7 @@ void CListEx::OnDestroy()
1401
1427
1402
1428
m_stWndTtCell.DestroyWindow ();
1403
1429
m_stWndTtLink.DestroyWindow ();
1430
+ m_stWndTtRow.DestroyWindow ();
1404
1431
m_fontList.DeleteObject ();
1405
1432
m_fontListUnderline.DeleteObject ();
1406
1433
m_penGrid.DeleteObject ();
0 commit comments