August 30th, 1999, 03:36 AM
Hi,
I am trying to do the following: If the user clicks anywhere on a CListCtrl (doesn't have to be the first column), the matching item should be selected. For this action, I am using code I found on codeguru's control section.
Why isn't it working?
void CPreislisteDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDown(nFlags, point);
int index;
point.x = 2;
if((index = m_cPreisListe.HitTest(point, NULL)) != -1)
{
MessageBox("OK");
m_cPreisListe.SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
}
Thanks!
Fox20
I am trying to do the following: If the user clicks anywhere on a CListCtrl (doesn't have to be the first column), the matching item should be selected. For this action, I am using code I found on codeguru's control section.
Why isn't it working?
void CPreislisteDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDown(nFlags, point);
int index;
point.x = 2;
if((index = m_cPreisListe.HitTest(point, NULL)) != -1)
{
MessageBox("OK");
m_cPreisListe.SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
}
Thanks!
Fox20