LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

save and restore tree expand state

Hi,

I have an application with a tree control. When the application quits, I save the tree data to a file and repopulate the tree when the application next starts.

I'd also like to be able to save the expand/collapse state of each branch. Is there a simple, global way to do this?

Cheers,

John.
0 Kudos
Message 1 of 3
(3,503 Views)
You could use SavePanelState and RecallPanelState for this. These functions will take a snap shot of the values of all the controls on your panel and save that data to a file you specify. The "value" of a tree control is pretty much the whole state of the tree control, including the items and their expanded/collapsed state. Since this function saves the state of the whole panel, and you may only want to save the state of the tree control, you could create a temporary panel at the beginning and end of your program that you copy the tree control to and then save and recall the state of that temporary panel.
 
I've attached a sample program that demonstrates SavePanelState and RecallPanelState.
 
Hope this helps,
 
- jared
0 Kudos
Message 2 of 3
(3,479 Views)

Thanks, Ill take a look at this.

 

John

0 Kudos
Message 3 of 3
(3,458 Views)