CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: MFC CTreeCtrl problem

  1. #1
    Join Date
    Dec 2008

    MFC CTreeCtrl problem

    I am trying to create my own CTreeCtrl using the sample code below:

    In my own CTreeCtrl, I will create my custom combobox when selecting an item on the CTreeCtrl. The position of the combobox created is based on the client rect of the selected CTreeCtrl item (i.e. HTREEITEM) (like the sample code). For any selection change on the combobox, I will call the parent CTreeCtrl function to create different child items (i.e. using CTreeCtrl:: DeleteItem to delete items for previous selection and CTreeCtrl:: InsertItem to create items for current selection) based on the selection in the combobox.

    However, when I select different values in the combobox, the position of the combobox is changed and not aligned to the plus/minus button. It is because the height of the items before and after calling DeleteItem/InsertItem are different and this will cause the CTreeCtrl to auto scroll the vertical bar. The combobox will only move to the correct position and aligned with the button after I de-select the combobox.

    I am not sure if I can disable auto vertical scroll in CTreeCtrl. Please could anyone suggest the best way to solve this problem?

    Many thanks!
    Last edited by chesschi; August 15th, 2012 at 05:58 AM.

  2. #2
    Join Date
    May 1999

    Re: MFC CTreeCtrl problem

    Is it necessary to delete and recreate tree item? You just chage a text and if you are using item data change it too.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)