How to drag drop layers using pythonaddins.OpenDialog()

286
4
01-24-2018 02:00 PM
SurendranNeelakantan
New Contributor III

I have a custom filtered   pythonaddins.OpenDialog()  , Is it possible to drag drop layers into TOC ?

This is possible  from windows explorer and folder connection.

0 Kudos
4 Replies
JoshuaBixby
MVP Esteemed Contributor

I am quite certain what you ask is not possible.  The OpenDialog() method calls the same dialog used by the Add Data.... dialog and many more, and you cannot drag & drop from within that dialog/control to the TOC.

SurendranNeelakantan
New Contributor III

Thank you for the reply.  In that case what is the advantage of using pythonaddins.OpenDialog()?  we can create a python adding  which calls the explorer window  as a sub process  and search and drag  layers from that to TOC.  which is  better  method ?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Which is better depends on your situation.  Calling OpenDialog() gets you a dialog that looks and functions like other dialogs users are used to in ArcGIS, and it is simple to code.  If dragging from the dialog to the TOC is important, and you are comfortable working with calling subprocesses, it seems that would be what is best in your situation.

0 Kudos
SurendranNeelakantan
New Contributor III

Thank you again, Personally I like  the ESRI  Add data like dialog, but our requirement is to let users search for layers from 100s  of layers from  different sub folders and add to TOC. We  can call  "explorer.exe"  using subprocess.popen  with  couple of lines of code. But I am not sure if there is any other issue with this, so far it works fine.   

0 Kudos