Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Docking problem

Posted on 2000-03-09
5
242 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
indy Tmemory stream non latin charcter issue 2 121
How to debug For loops? 3 57
Tembedded WB animatid gifs not animated on some pcs 2 84
Dev express lookupcombo 3 35
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 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