Hot Door CORE Forum

Full Version: setting HierarchicalView current entry
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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