CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    21

    CTreeView control - problem in recognize item that was click.

    Hi All,

    I need to write some GUI application that uses CTreeView control.
    I writing it with using ATL and use method like TreeView_SetItemState, TreeView_InsertItem and extra.
    I'm using control attribute of check box --> each item have check box with some string.

    I found out that in case of double click on some item i have problem on identify the current item.

    What i mean is that in case the double click is on the string that describe the selected item than all work find and i getting the right HTREEITEM --- but in case the double click is on the check box of the selected item then i getting wrong HTREEITEM (!!!).

    The method that getting the event return me LPNMHDR pnmh type -- with this type i do casting to
    NMTREEVIEW* that will hold me

    TVITEM itemOld;
    TVITEM itemNew;

    None of them are not hold me the info of the right HTREEITEM .

    I must have the right HTREEITEM to know which item was selected in case of click event or/and double click event.

    I will be happy to get any help to find out the problem.

    Thanks.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: CTreeView control - problem in recognize item that was click.

    You should get the selected item using TreeView_GetItem (with TVITEM parameters set for selected item) directly after the click/double-click (in correspondent message handlers)

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