Autor Beitrag
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 25.09.05 17:38 
Hallo,

ich versuche einen Treeview auf den ich per Drag&drop einen Eintrag aus einer Listbox ziehe, aufzuklappen, wenn das Drag&Drop Element auf einen Knoten trifft, der Untereinträge hat.

Ein Beispiel: Ich habe einen Treeview mit drei Einträgen: 100,200 und 300. Darunter sind jeweils Einträge von 101-199, 201-299 usw.

Der Treeview ist zugeklappt, sichtbar sind also nur die Knoten 100,200 und 300. Wenn ich jetzt einen Eintrag aus der Listbox auf den Treeview-Knoten 120 ziehen möchte, dann ziehe ich zuerst auf 100, der klappt auf und ich kann auf 120 ziehen. So soll es sein.

Habe in der Suche nichts gefunden, kann einer helfen ?

Danke

Thomas
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 25.09.05 18:20 
Hallo,

ob das genau deinen Wunschabläufen entspricht?
Es ist geht aber in die gewünsche Richtung, halt noch an deine Bedingungen anpassen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.TreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
var aNode : TTreeNode;
begin
  if (htOnLabel in TreeView1.GetHitTestInfoAt(x,y)) then
    begin
    aNode := TreeView1.GetNodeAt(X, Y);
    aNode.Expanded := True;
    end;
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )


Zuletzt bearbeitet von Lannes am So 25.09.05 20:30, insgesamt 1-mal bearbeitet
PLuS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98

Win XP, Suse Linux 9.0
D5 Standard, D2005 Personal; Perl; PureBasic
BeitragVerfasst: So 25.09.05 18:27 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.TreeView1DragDrop(Sender, Source: TObject; X,
  Y: Integer);
var Zielnode: TTreeNode;
begin
     Zielnode:=TreeView1.GetNodeAt(X, Y);
     if Zielnode.Item.Count > 0 then
        Zielnode.Expand(True);
end;

_________________
Der letzte macht die Tür zu!
tomtom62 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Mo 26.09.05 17:54 
@Lannes: Danke, das ist das, was ich gesucht habe.

@Plus: Danke für Deine Hilfe, aber so wie ich das verstehe, wird bei Deiner Lösung erst nach dem Drop expandiert.