Drag & drop from VTreeView
Moderators: SDS, support, admin
Drag & drop from VTreeView
Hello!
I would like to achieve drag and drop between VirtualTreeview and CADImportVCL. It would be rather 'simple' because i dont need any data transfer between the two component.
All i want is grab a node from VTree and pull it over cadimport, release the mouse button and make a graphic object (entity?) on the CAD drawing with the appropriate methods. So i need only the mouse X,Y coordinates when release the button over Cimportvcl...
i tried this:
But when i drag over cadimport, i get the prohibit icon so it cant 'receive' the node.
ImageCADiDragDrop is a TImage.
Thank you in advance.
Regards,
I would like to achieve drag and drop between VirtualTreeview and CADImportVCL. It would be rather 'simple' because i dont need any data transfer between the two component.
All i want is grab a node from VTree and pull it over cadimport, release the mouse button and make a graphic object (entity?) on the CAD drawing with the appropriate methods. So i need only the mouse X,Y coordinates when release the button over Cimportvcl...
i tried this:
Code: Select all
procedure TForm1.ImageCADiDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := Source is TVirtualStringTree;
end;
procedure TForm1.ImageCADiDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
ShowMessage('Itt engedték el: x=' + IntToStr(X) + ' y=' + IntToStr(Y));
end;
ImageCADiDragDrop is a TImage.
Thank you in advance.
Regards,
Re: Drag & drop from VTreeView
Hello.
If you need only mouse coordinates then you don't need drag&drop anything: just use one of mouse button events. However drag&drop means transfer some data between components. Also that is the node from "VirtualTreeview" component?
Alexander.
If you need only mouse coordinates then you don't need drag&drop anything: just use one of mouse button events. However drag&drop means transfer some data between components. Also that is the node from "VirtualTreeview" component?
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Drag & drop from VTreeView
___
Last edited by box_ on 20 Nov 2010, 20:27, edited 1 time in total.
Re: Drag & drop from VTreeView
Sorry i was talking stupid. (: No any Timage, please see the code. (Nothing interesting.)
Tried to program the sPanel_layout's (TsPanel) events ('OnDragDrop' and 'OnDragOver') but nothing happens. So how could i activate event handling on a TSGDrawingNavigator?
I need the mouse X,Y coordinates when drag&drop on the drawingnavigator (then create an entity at the given location).
Thank You!
Trying Drag and drop onto the drawing (which is on a panel 'sPanel_layout')
Tried to program the sPanel_layout's (TsPanel) events ('OnDragDrop' and 'OnDragOver') but nothing happens. So how could i activate event handling on a TSGDrawingNavigator?
I need the mouse X,Y coordinates when drag&drop on the drawingnavigator (then create an entity at the given location).
Thank You!
Code: Select all
type
TForm1 = class(TForm)
private
FsgPaintBox: TsgDrawingNavigator;
public
property sgPaintBox: TsgDrawingNavigator read FsgPaintBox;
procedure TForm1.FormCreate(Sender: TObject);
begin
FsgPaintBox := TSGDrawingNavigator.Create(Self);
FsgPaintBox.Parent := sPanel_layout;
FsgPaintBox.AutoFocus := True;
FsgPaintBox.RectZooming := True;
FsgPaintBox.Align := alClient;
end;
Code: Select all
procedure TForm1.sPanel_layoutDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
ShowMessage('drag&drop ok!'); //later get the coordinates here
end;
procedure TForm1.sPanel_layoutDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := Source is TVirtualStringTree;
end;