Ver Mensaje Individual
  #1  
Antiguo 08-12-2005
Gabriel2 Gabriel2 is offline
Miembro
 
Registrado: sep 2004
Posts: 108
Reputación: 20
Gabriel2 Va por buen camino
Arrastrar y soltar en un TreeView

Hola compañeros del foro.

Utilizo Delphi 7. Mi ide es poder mover los nodos en un TreeView de una rama a otra. Su estructura es de varias ramas con 4 o 5 niveles. Busque en el foro y encontre código para poder realizarlo. He probado y no consigo hacerlo.

Código:
procedure TForm1.MenusDragDrop(Sender, Source: TObject; X, Y: Integer);
var
   AnItem: TTreeNode;
   AttachMode: TNodeAttachMode;
   HT: THitTests;
begin
  if Menus.Selected = nil then Exit;
  HT := Menus.GetHitTestInfoAt(X, Y) ;
  AnItem := Menus.GetNodeAt(X, Y) ;
  if (HT - [htOnItem, htOnIcon, htNowhere, htOnIndent]<> HT) then
  begin
	if (htOnItem in HT) or (htOnIcon in HT) then AttachMode := naAddChild
  else if htNowhere in HT then AttachMode := naAdd
  else if htOnIndent in HT then
	AttachMode := naInsert;
	Menus.Selected.MoveTo(AnItem, AttachMode) ;
  end;
end;
Esta es la pagina en donde esta el código.

Saludos. Gracias...
Responder Con Cita