09-22-2023, 12:22 PM
(This post was last modified: 09-25-2023, 12:48 PM by Rick Johnson.)
I'm trying to set the selected item of a hierarcical view. It took me a while to figure this out, but HierarchicalView.setCurrentIDPath() does cannot always select an item programmatically. For example, with all top-level items closed:
IDVector spec;
spec.push_back("Chevrolet");
spec.push_back("Camaro");
bool success = myHierarcicalView.setCurrentIDPath(spec);
// success is returned as TRUE
// myHierarcicalView.currentEntry() returns NULL.
It seems one has to explicitly expand every branch above the final node, something like this:
(*myHierarcicalView.entries())[1]->setExpanded(true);
... then call setCurrentIDPath().
It would be really nice if setCurrentIDPath and setCurrentIndexPath would automatically expand all branches so that the selection could take place.
-- Rick
IDVector spec;
spec.push_back("Chevrolet");
spec.push_back("Camaro");
bool success = myHierarcicalView.setCurrentIDPath(spec);
// success is returned as TRUE
// myHierarcicalView.currentEntry() returns NULL.
It seems one has to explicitly expand every branch above the final node, something like this:
(*myHierarcicalView.entries())[1]->setExpanded(true);
... then call setCurrentIDPath().
It would be really nice if setCurrentIDPath and setCurrentIndexPath would automatically expand all branches so that the selection could take place.
-- Rick