Solved

Docking problem

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now