When loading a saved session in an audio plug-in, I need to restore the GUI to its previous state, and that includes selecting an item in a TreeView that was previously selected. However, the contents of the TreeView may have changed since the session was saved, so I search the contents for the TreeViewItem I am interested in (by its name field), and then I want to select that one item in the TreeView (and scroll it into view). I have tried calling setSelected() on that item, but that doesn’t seem to cause the TreeView to highlight the item (even if I manually scroll it into view).
How can I tell the TreeView which item needs to be drawn as selected? (I see I can scroll it into view using scrollToKeepItemVisible(), but I don’t see any TreeView commands to make the item highlighted.
Oh, one thing: I am using dontSendNotification in the setSelected() call, because I don’t want the selection to propagate through the system, which will cause the TreeViewItem’s contents to load into other elements of my plug-in. Those elements may have been manually altered after the selection in the TreeView was made originally, and propagating the selection through the normal channels (as if clicking on it in the TreeView) will overwrite those values. So what I need is just a way to apply the highlight, without the callbacks occurring that normally happen when clicking on an item.