I use MFC VC++ to code a monitor program.
It shows the data on the ListCtrl screen, the listctrl has 10 columns with report style.
While the screen does not scroll, it is focused by one row directly.
But while the screen does scroll, if I focus one row, the cursor cover more rows and grows covering full screen.
I want to do focusing one row directly while scrolling of monitor screen.
OnInitDialog() and NM_CLICK event of the ListCtrl, I used several Styles like as follows.
m_List_2100.ModifyStyle(0, LVS_REPORT, NULL);
m_List_2100.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
On the NM_CLICK events:
void CForm2000::OnNMClickList2100(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<lpnmitemactivate>(pNMHDR);
NMLISTVIEW *pNMListCtrl = (NMLISTVIEW*)pNMHDR;
int nSelectIndex = pNMListCtrl->iItem;
m_List_2100.SetItemState(nSelectIndex, LVIS_SELECTED, LVIS_SELECTED);
m_List_2100.EnsureVisible(nSelectIndex, TRUE);
m_List_2100.SetFocus();
}
Thank you.
What I have tried:
I was coding as many conditions of above, but all failed.