CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 1999
    Posts
    91

    Question How to get point for SubItemHitTest in CListCtrl?

    Hi,

    When using SubItemHitTest I need to fill the structure LPLVHITTESTINFO item point with the point clicked in the CListCtrl.

    How do I get that point?
    When using the message NM_CLICK I only get a NMHDR and LRESULT, not a point clicked.

    Please help.

    Regards,

    Maurice

  2. #2
    Join Date
    Feb 2002
    Posts
    3,788

    Re: How to get point for SubItemHitTest in CListCtrl?

    Originally posted by Maurice Sanders
    Hi,

    When using SubItemHitTest I need to fill the structure LPLVHITTESTINFO item point with the point clicked in the CListCtrl.

    How do I get that point?
    When using the message NM_CLICK I only get a NMHDR and LRESULT, not a point clicked.

    Please help.

    Regards,

    Maurice
    this should help:
    PHP Code:
    // The pointer to my list view control.
    extern CListCtrlpmyListCtrl;
    // The pointer where the mouse was clicked.
    extern CPoint myPoint;

    LVHITTESTINFO lvhti;

    // Clear the subitem text the user clicked on.
    lvhti.pt myPoint;
    pmyListCtrl->SubItemHitTest(&lvhti);

    if (
    lvhti.flags LVHT_ONITEMLABEL)
    {
       
    pmyListCtrl->SetItemText(lvhti.iItemlvhti.iSubItemNULL);


  3. #3
    Join Date
    Aug 1999
    Posts
    91
    Hi,

    The example is clear to me. I saw that example already, but how do I get that point where the mouse is clicked in the CListCtrl?
    That is what I really want to know.
    How do I get that point in the NM_CLICK event of the CListCtrl.

    Regards,

    Maurice

  4. #4
    Join Date
    Feb 2002
    Posts
    3,788
    Originally posted by Maurice Sanders
    Hi,

    The example is clear to me. I saw that example already, but how do I get that point where the mouse is clicked in the CListCtrl?
    That is what I really want to know.
    How do I get that point in the NM_CLICK event of the CListCtrl.

    Regards,

    Maurice
    void CYourDlg::OnClickYourList(NMHDR* pNMHDR, LRESULT* pResult)
    {
    POINT point;
    GetCursorPos(&point);
    lvhti.pt = point;
    .....................
    }

  5. #5
    Join Date
    Aug 1999
    Posts
    91
    Thanks,

    The only thing that needs te be done is ScreenToClient and to offset the listcontrol. This offset is needed because I am using a CFormView and the listcontrol is in the middle of that form.

    Regards,

    Maurice

  6. #6
    Join Date
    Feb 2002
    Posts
    3,788
    Originally posted by Maurice Sanders
    Thanks,

    The only thing that needs te be done is ScreenToClient and to offset the listcontrol. This offset is needed because I am using a CFormView and the listcontrol is in the middle of that form.

    Regards,

    Maurice
    ...yes, indeed, that i've omitted

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