Solved

Docking problem

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 169
Delphi with SQL Natvie Client 15 85
Delphi cmd execution 6 55
how to send memory stream from ics Client To ics server ? 11 79
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

930 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

11 Experts available now in Live!

Get 1:1 Help Now