CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2012
    Posts
    181

    Question "Windows Explorer"

    If I use "Windows Explorer" style in MFC application how work with events in CTreeView. For example with OnExpand. Because in MESSAGEMAP it is needed to write name of CTreeView, but name i can't find. How get it?

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

    Re: "Windows Explorer"

    What "name of CTreeView" do you mean?
    What IDE are you using?
    In what class are you trying to implement message handler?
    Victor Nijegorodov

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: "Windows Explorer"

    Just click on the Class View tab in Visual Studio, select the CTreeView derived class, right click and select properties, click on the messages button and add you handler. (This is for 2008. Other versions may be different).

  4. #4
    Join Date
    Feb 2012
    Posts
    181

    Re: "Windows Explorer"

    What "name of CTreeView" do you mean?
    For example, in
    ON_NOTIFY(TVN_ITEMEXPANDING, IDC_TREE1, OnItemExpandingTree1)
    "IDC_TREE1"...
    What IDE are you using?
    VS2008
    In what class are you trying to implement message handler?
    In CMainFrame class...

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: "Windows Explorer"

    Quote Originally Posted by AKE View Post
    What "name of CTreeView" do you mean?
    For example, in
    ON_NOTIFY(TVN_ITEMEXPANDING, IDC_TREE1, OnItemExpandingTree1)
    "IDC_TREE1"...
    What IDE are you using?
    VS2008
    In what class are you trying to implement message handler?
    In CMainFrame class...
    Wouldn't that be better handled in the TreeView class?

  6. #6
    Join Date
    Feb 2012
    Posts
    181

    Re: "Windows Explorer"

    GCDEF, there is OnExpanding absent...

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

    Re: "Windows Explorer"

    Quote Originally Posted by AKE View Post
    What "name of CTreeView" do you mean?
    For example, in
    ON_NOTIFY(TVN_ITEMEXPANDING, IDC_TREE1, OnItemExpandingTree1)
    "IDC_TREE1"...
    It is NOT a name, it is a control ID
    And in CTreeView derived class this macro is not used. Instead the
    Code:
    	ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnItemExpandingTree1)
    should be used.

    Quote Originally Posted by AKE View Post
    What IDE are you using?
    VS2008
    Well, GCDEF already explained how to add message handler in 2008.

    Quote Originally Posted by AKE View Post
    In what class are you trying to implement message handler?
    In CMainFrame class...
    Bad idea! Why in CMainFrame?
    It should be in a CTreeView derived class!
    Victor Nijegorodov

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: "Windows Explorer"

    Quote Originally Posted by AKE View Post
    GCDEF, there is OnExpanding absent...
    I see TVN_ITEMEXPANDING

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

    Re: "Windows Explorer"

    Quote Originally Posted by GCDEF View Post
    I see TVN_ITEMEXPANDING
    ... and I also use it since more than a decade...
    Victor Nijegorodov

  10. #10
    Join Date
    Feb 2012
    Posts
    181

    Re: "Windows Explorer"

    VictorN, thanks I will make such... Now I try use it...

Tags for this Thread

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