RE: saving layout of TreeView control
- From: Adrian Voicu <AdrianVoicu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 15 Aug 2007 06:56:02 -0700
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
- Follow-Ups:
- RE: saving layout of TreeView control
- From: dshemesh
- RE: saving layout of TreeView control
- Prev by Date: Re: Is there a dialog box that I can you to allow users to change working directory?
- Next by Date: Re: Simple (regex?) string manipulation
- Previous by thread: Is there a dialog box that I can you to allow users to change working directory?
- Next by thread: RE: saving layout of TreeView control
- Index(es):
Relevant Pages
|