Solved

Docking problem

Posted on 2000-03-09
5
241 Views
Last Modified: 2010-04-04
I created a simple form (TForm) that includes just a TTreeView-Control. I fill this TTreeView within the Form with the following method:

procedure TChildSystemView.UpdateTree;
var
  node: TTreeNode;
  childNode: TTreeNode;
  i: Integer;
begin
  SystemTree.Items.Clear;
  node := SystemTree.Items.Add(nil, FLeagueSystem.SystemName);
  node.ImageIndex := 0;
  node.SelectedIndex := 0;
  if FLeagueSystem.NumberOfLeagues > 0 then
            for i := 1 to FLeagueSystem.NumberOfLeagues do begin
          childNode := SystemTree.Items.AddChild(node, FLeagueSystem.Leagues[i - 1].LeagueName);
      childNode.ImageIndex := 1;
      childNode.SelectedIndex := 1;
    end;
end;

This works fine. But this window is a dockable window within a parent Form and it is docked by default when I start the program. This works fine too. The problem is that when I undock the window and I re-dock it to the parent, all data within the tree is lost. What can I do?
0
Comment
Question by:klusi
  • 3
5 Comments
 
LVL 3

Expert Comment

by:ckaneta
ID: 2601745
just a lame attempt: did you try calling update function from forms repaint event handler?
0
 

Author Comment

by:klusi
ID: 2601957
no, but this seems useless because I saw in the debugger that after the re-dock the tree's items-property was set to nil ! So it was empty and an update should give nothing.
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2602040
Oh this looks as would the tree window be recreated which usually kills the content (although the VCL contains code to save the nodes to restore them later). Unfortunately, the Windows treeview is such a badly made thing you will get very often problems if you want to do something more than the absolute basics. I recommend that you save the tree content to a memory stream just before you change its dock state and restore it after that.

Another point, look at my home page www.lischke-online.de and download TreeNT, which is a free tree implementation which tries to get around many of the problems (though not always successfully).

Ciao, Mike
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2652543
klusi?
0
 
LVL 10

Accepted Solution

by:
Lischke earned 100 total points
ID: 2758460
No reaction, then LOCK.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question