开发者

SWT: Drag-and-drop Internal Object

开发者 https://www.devze.com 2023-02-12 05:52 出处:网络
My application has a canvas and a table, I need to add drag-and-drop capabilities to it.However, I read in a tutorial that Transfer converts the data I want to move into a platform-independent type.I

My application has a canvas and a table, I need to add drag-and-drop capabilities to it. However, I read in a tutorial that Transfer converts the data I want to move into a platform-independent type. I have no need to drag anything outside of my program, and it's important that开发者_StackOverflow the exact object be sent. How can this be done?


Okay, I figured it out. Apparently you can use some bogus transfer object, and keep the objects you want to move in your own variable. Define the variable when the drag starts, (from the DragSource), and get the item from the variable in DropTarget. Just ignore the bogus transfer object.

0

精彩评论

暂无评论...
验证码 换一张
取 消