drag and drop from taskpane

Good aftenoon!

im building a c# plugin, and need to implement drag&drop operations, the scenario is like:

my taskpane have a treeview with parts, and i need to drop them in assembly,

iv set a breakpoint in "Doc_FileDropPreNotify" but never get fired...

any help would be appreciated.

SolidworksApi macros
Answers 4
AJ
AJ 2017-07-08 Best Answer

We are NOT wizards. We need code Mr. Roman

RM
RM 2017-07-08

Hello Mr. Jlili, i didnt thought that was important the code, but was nice that you remember me that, now the question is:

what parts of the code should i post here?

in AssemblyEventHandler class:

override public bool AttachEventHandlers()

{

     doc.FileDropPreNotify += Doc_FileDropPreNotify;

     return true;

}

private int Doc_FileDropPreNotify(string FileName)

{

      System.Windows.Forms.MessageBox.Show("DropDetected");  -> never run with dragged files from my treeview;

      return 0;

}

in taskpane class:

fdtv_projectTree.AllowDrop = true;

private void fdtv_projectTree_ItemDrag(object sender, ItemDragEventArgs e)

{

      var node = (FControls.FDirectoryTreeNode)e.Item;

       ((FControls.FDirectoryTreeView)sender).DoDragDrop(node.Path, DragDropEffects.Copy);

}

private void fdtv_projectTree_DragEnter(object sender, DragEventArgs e)

{

     e.Effect = DragDropEffects.Copy;

}

Hope this can clarify what im trying to do, drag operations from the native explorer treeview taskpane are workinf and the event Doc_FileDropPreNotify is reached...

can be something related with permissions?

thank you in advance,

Bruno Frade.

RS
RS 2021-01-30

Have you solved this  mater,I have question same to you .

AJ
AJ 2021-01-31

Try running your program in release mode (without visual studio debugger) and use a msgbox to print the filename. 

Best,
Amen
SOLIDWORKS PDM API Programming services