Autor Beitrag
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 09.04.03 07:59 
Hi Leute

ich ein nervendes Problem mit VirtualTreeView und finde keine Lösung dafür. Ich verwende folgende Procedure um Nodes zu erstellen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TfrmExplorer.AddAlias(Alias: string);
var
   data: PNodeRecord;
   node: PVirtualNode;
begin
   Node := tvw.AddChild(nil);
   Data := tvw.GetNodeData(Node);
   Data.FCaption   := Alias;
   Data.FType    := 3;
   Data.FState    := -1;
   tvw.ValidateNode(Node, False);
end;

Das funktioniert auch einwandfrei. Wenn das Fenster erzeugt wird, wird mit dieser Prozedur eine ganze Reihe von Nodes erzeugt. Alles wunderbar. Wenn ich aber im späteren Programmablauf einen weiteren Node erzeuge, lässt sich dieser nicht selektieren wenn man auf die Beschriftung klickt. Wenn ich auf das Image klicke funktionierts und wenn der Node einmal geöffent war, dann hauts ebenfalls einwandfrei hin.
Hat vielleicht irgendwer ne Idee woran das liegen könnte?

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...


Zuletzt bearbeitet von LCS am Mi 09.04.03 14:22, insgesamt 1-mal bearbeitet
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 09.04.03 08:21 
Kann jetzt nicht selber testen und auch nicht in die VT-Doku schaun..
Ich verwend bei meinem X-Spy auch den VT (mit einem ähnlichen Source wie du) und es funktioniert alles bestens..
Das einzige was ich nicht hab is der Aufruf von ValidateNode(). Was macht die Methode bzw. was passiert wenn du das weglasst?
Hast du noch irgendwelche Event-Handler für den VT?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
LCS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 09.04.03 08:48 
Hi
laut Doku soll ValidateNode sicherstellen, das der Knoten korrekt initialisiert ist. Allerdings ist es vollkommen egal ob ich das verwende oder nicht, das verhalten bleibt gleich.
Es gibt auch noch ne Reihe von Event-Handlern, aber selbst wenn ich die alle auskommentiere bleibt das Problem bestehen. :autsch:

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Tower
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 99



BeitragVerfasst: Mi 09.04.03 09:19 
Ja, so gut ich den VirtualTreeView sonst finde, den Punkt finde ich auch noch immer undurchsichtig. Was manchmal (!) bei mir geholfen hat, ist: Vor und hinter dem Hinzufügen des neuen Nodes ein TreeView.BeginUpdate bzw. TreeView.EndUpdate zu setzen.

Aber - wie gesagt - klappt auch nur in manchen Fällen...

Wenn du noch was rausfindest, poste es doch bitte! Denn das hat mich auch schon einige Mal genervt...
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 09.04.03 09:42 
Also ich konnte noch nie ein derartiges Verhalten feststellen... *wunder*
verwendet ihr die aktuelle Version? -> schaut mal auf www.dephi-gems.com

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
LCS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 09.04.03 14:22 
Dank dir Tower. Der Tip mit BeginUpdate/EndUpdate hats erst mal gebracht.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
   tvw.BeginUpdate;
   Node := tvw.AddChild(nil);
   tvw.ValidateNode(Node, False);
   Data := tvw.GetNodeData(Node);
   Data.FCaption   := Alias;
   Data.FType    := 3;
   Data.FState    := -1;
   tvw.EndUpdate;

In der Konstellation funktionierts nun.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...