Drag & drop from VTreeView

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
box_
Posts: 5
Joined: 18 Nov 2010, 19:25

Drag & drop from VTreeView

Post by box_ » 18 Nov 2010, 19:44

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:

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;
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,

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Drag & drop from VTreeView

Post by support » 19 Nov 2010, 16:22

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

box_
Posts: 5
Joined: 18 Nov 2010, 19:25

Re: Drag & drop from VTreeView

Post by box_ » 19 Nov 2010, 16:38

___
Last edited by box_ on 20 Nov 2010, 20:27, edited 1 time in total.

box_
Posts: 5
Joined: 18 Nov 2010, 19:25

Re: Drag & drop from VTreeView

Post by box_ » 19 Nov 2010, 16:50

___

box_
Posts: 5
Joined: 18 Nov 2010, 19:25

Re: Drag & drop from VTreeView

Post by box_ » 20 Nov 2010, 20:44

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!

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;
Trying Drag and drop onto the drawing (which is on a panel 'sPanel_layout')

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;


Post Reply