TreeViewCustomGui MakeVisible()



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/07/2006 at 15:04, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.102 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    I'm not getting the expected results with this (and it appears to be the only possible way to scroll to a selected element so that it is visible).

    My TreeView is 'virtual'. That is, subitems are only filled in when a folder-type item is opened. Until then, it holds a temporary item to allow opening by the user.

    Nonetheless, when an item is to be shown, the tree is first unfolded to that item, filling in the necessary hierarchy - so it is no longer virtual. Then I call tree->MakeVisible(selectedItem), but instead of scrolling to make the item visible, it actually backs out and closes several folder levels (?). Why would this happen if the item is non-virtual and visible through unfolding?

    All that I really need here is the scrolling part so that this item is within the UserArea visible region. The unfolding part must be done by my own code since the tree is virtual.

    // Collapse All Folders - so that only the result is displayed
    root.ExpandAll(FALSE);
    // Unfold to search result
    // The item matching result is made the selected item (verified)
    root.Unfold(ri->GetFilename().GetString());
    // This keeps folding back several levels
    tree->MakeVisible(root.GetSelected());

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/07/2006 at 17:17, xxxxxxxx wrote:

    After some consideration, it appears that MakeVisible() calls TreeViewFunctions::Open() whether it IsOpened() or not. Since my code for Open() is particular to the virtual nature of the hierarchy, MakeVisible() did not like this at all.

    The solution here is to set a mode before MakeVisible() that just skips the Open() code and then unset the mode after MakeVisible(). Works perfectly!

         // Collapse All Folders  
         root.ExpandAll(FALSE);  
         // Unfold to search result  
         root.Unfold(ri->GetFilename().GetString());  
    #ifdef C4D_R9  
         if (root.GetSelected())  
         {  
              root.SetSearchMode(TRUE);  
              tree->MakeVisible(root.GetSelected());  
              root.SetSearchMode(FALSE);  
         }  
    #endif
    

Log in to reply