CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    CListCtrl DblClk on item

    Hi,

    if an item was double clicked, how do I get to know which one was it?

    TIA,


    Fox20


  2. #2
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: CListCtrl DblClk on item

    Try HitTest function:

    void CTree::OnLButtonDblClk(UINT nFlags, CPoint point)
    {
    HTREEITEM hi = HitTest( point, &nFlags);
    }




    Let me know if this help u
    Regards,
    Ovidiu


  3. #3
    Join Date
    Aug 1999
    Location
    Lithuania, Vilnius
    Posts
    35

    Re: CListCtrl DblClk on item

    hi,

    You can do it handling WM_LBUTTONDBLCLK window
    message. There is message handler:

    void CCListViewTestView::OnLButtonDblClk(UINT nFlags, CPoint point)
    {
    LVHITTESTINFO lvItemInfo;
    lvItemInfo.pt = point;

    if(-1 != GetListCtrl().SubItemHitTest(&lvItemInfo))
    {
    CString str = GetListCtrl().GetItemText(lvItemInfo.iItem, lvItemInfo.iSubItem);
    AfxMessageBox(str);
    }

    CListView::OnLButtonDblClk(nFlags, point);
    }

    SubItemHitTest saves info to lvItemInfo about current item.

    Hope this will help


    ================
    Marius Bakelis
    Software Developer
    Matrix Software Baltic
    www.matrix-software.nl
    =================
    Regards,
    Marius Bakelis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured