cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How graphics are adding in a drag and drop operation

kristian.vantas
1-Visitor

How graphics are adding in a drag and drop operation

Hello adepters,

I want to understand how graphics drag and drop support is done in Editor.

If I drag a graphic from the filesystem and put it into my XML session, the (with at least some help from the dcf file, I assume), interprets this as a graphic and then inserts the graphic element with an href to my local file system path of the graphic (from where I dragged it from). This works great.

I want to understand how this works as I have a requirement to drag an object from my proprietary java application and have it work in the same way. I've taken an initial look in some documentation but mostly find information such as how to insert graphics via menu options in Epic. I tried a couple of easy mocks, such as copying the object in Windows and pasting in a valid place in Epic, and also copying the path of the graphic and pasting in a valid location, to no avail. The only thing that works is a straight drag and drop from Windows to Epic. Can anyone point me in the right direction?

Thanks!


Kristian Van Tassell
LMD Tools

Siemens Industry Sector
Siemens Product Lifecycle Management Software Inc.
5939 Rice Creek Parkway
Shoreview, MN 55126 United States
Tel. :+1 (651) 855-6194
Fax :+1 (651) 855-6280
- <-%20>
www.siemens.com/plm

1 REPLY 1

Hi Kristian--

You can probably make this work the way you want using session callbacks to handle the drag/drop operation. Look in the Help Center for "session_add_callback" for info on the callbacks used to handle drag/drop. Then, you just need to make sure that the Java app puts the right thing on the clipboard for the drag operation (most likely a file path to the graphic source).

Here's some simple drop handler code from an old presentation I gave. It's not explicitly for handling graphics, but it shouldn't be hard to adapt to your use case.

--Clay

# ACL drop handler code

function drop_handler(path,num,count,flags) {
local $ext = tolower(substr($path,length($path)-3));
if ($ext == "xml") {
if ($flags & 0x0001) { # SHIFT-drag
# insert content inline
execute("read " . $path);
}
else if ($flags & 0x0002) { # CTRL-drag
# insert Xinclude reference
$xi = "<xi:include href=" . $path . "/>";
insert($xi);
}
else {
execute("edit -newwindow " . path);
}
}
}

session_add_callback("drop_file",drop_handler);

Announcements

Top Tags