RE: saving layout of TreeView control

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




If you close the form, the pointer will point to nothing as the object will
be destroyed. What you could do however is hide the form with the Hide()
method. Later when you want to show it again just use the Show() method.

If you want however to retain the layout of the tree view even after you
close your application and turn off the computer, you can save the layout
structure in a local xml file like the example I gave earlier, otherwise if
you are not concerned about that you can just hide the form!

Adrian.
--
[Please mark my answer if it was helpful to you]




"dshemesh" wrote:

Just to make sure:
When I close the form, I still hold a pointer to it, so it's not totally
destroyed. When I reopen it, I call showDialog() for the same Form instance I
closed before.
Is this still the case?
--
dshemesh


"Adrian Voicu" wrote:


Once you close the form with the tree view, the form object and all the
objects it contained are destroyed and the memory is reused. What you could
do is write some code such that when the form is closing you save the state
of the tree view to a file like xml for example. You should keep it simple:
ie for each node in the tree check if it is expanded or collapsed and store
that in the xml file. When the form is opened, it should check this file to
see how to present the tree when it loads.

Adrian.
--
[Please mark my answer if it was helpful to you]




"dshemesh" wrote:

Hello,
I have a windows form with a TreeView control.
When I first open the tree all nodes are colapsed. Then, I expand some of
them and close the form.
When I call Form.showDialog() once again all nodes are collapsed again.
I would like the layout to be saved (nodes which I expanded should stay
expanded). I don't change the ImageList, Scrollable, CheckBoxes or
StateImageList properties of the control between closing and reopening the
form.

any ideas?

thanks,
--
dshemesh
.



Relevant Pages

  • expand parts of an xml, which is transformed by xslt to html
    ... I have an xml file, which contains scientific data in a tree form. ... It is quite easy to parse the tree and collapse or expand the whole ...
    (comp.text.xml)
  • RE: saving layout of TreeView control
    ... If you want however to retain the layout of the tree view even after you ... "dshemesh" wrote: ... that in the xml file. ... Then, I expand some of ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: TreeView Dynamic XML Binding
    ... By monitoring the treeview child nodes when I explicitly set the XmlDataSource.DataFile, I determined that the process is actually using the PopulateOnDemand processing. ... I'm going to put the xml document into a session variable. ... It seems as if the default settings are doing the populate on expand ... otherwise the entire tree reset. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: TreeView Dynamic XML Binding
    ... XmlDataSource control. ... I'm going to put the xml document into a session variable (I don't ... otherwise the entire tree reset. ... telling it to .Expand rather than .Select. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: file problem
    ... like tdom, perhaps, to parse and search the xml file, and file rename ... the resulting tree under /tmp/mytest is: ... puts "processing $filename" ... global compareTime destdir errors ...
    (comp.lang.tcl)