How to drag and drop a picture at run time in a window displaying pictures?

How to drag and drop a picture at run time in a window displaying pictures?

Post by Chris_C » Fri, 27 Apr 2007 02:10:16


vivman,
We're going to need more information from you. What controls are you using? What version of LabVIEW? What are you dragging from and what are you dragging to? Can you elaborate on your problem.
 
Chris C
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Chris_C » Sat, 28 Apr 2007 07:40:11

vivman,
So from your description you have a picture control where you've already created an image and you'd like to drag an image around inside of the picture control. This can be done although it is going to take a significant amount of research and programming on your behalf. You can use the drag event in the event handler to find out when the drag occurs and where the cursor is. Then edit the picture as you move your mouse so that when you drop the picture gets updated.
 
The even structure is a somewhat advanced topic and the drag and drop feature is one of the more advanced uses of this structure. I would search the example finder (help>>find examples) for "event" and "drag" to see how to use these events. Also you'll want to look at the examples for the picture control.
 
Sounds like a cool project! Check out Darren's Weekly Nugget 10/30/2006 this topic (<a href=" http://www.yqcomputer.com/ ;message.id=212920" target="_blank"> http://www.yqcomputer.com/ ;message.id=212920</a>). It might prove useful.
 
Good luck!
 
 
Chris C

 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by zou » Sat, 28 Apr 2007 08:40:09

It might be easier to use 2 picture controls.  One for displaying the window glass.  One for display in the circle.
You can one on top of another, and make the background transparent.  To display circle without background, you can use mask.
Moving the circle inside the picture control is easy.  You don't need the drag and drop event.  All you need is mouse down, mouse move, mouse up event.
When mouse down, register mouse move, and mouse up event.  In mouse move event, reset the picture origin.
When mouse up, unregister mouse move, mouse up event.
 
George Zou
<a href=" http://www.yqcomputer.com/ " target="_blank"> http://www.yqcomputer.com/ </a>
 
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Darre » Sat, 28 Apr 2007 08:40:09

Yup, I think you'll want to take the approach described in my nugget, where you have a second, transparent picture control that you move around over the original picture control that contains your circle picture.  On Mouse Up, draw the circle in the right spot on the main picture control, and get the coordinates of the mouse so you will know where the obstacle is in your picture.  This will also help you remember the location of the circle in the big picture if you want to do other things like drag it around later.
 
Good luck,
-D
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Ben » Sat, 28 Apr 2007 22:10:08

vivman wrote;
 
I will try it n come back 2 u
 



 
Oh yes please do!
 
An example of this type would be a good addition to the Picture Control collection.
Ben
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Darre » Sat, 28 Apr 2007 23:40:17

I'll try to find some time in the coming weeks/months to write a Darren's Occasional Nugget specifically on dragging/dropping in the picture control.
-D
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Ben » Sun, 29 Apr 2007 05:10:08

Darren wrote;
" I'll ... write a Darren's Occasional Nugget specifically on dragging/dropping in the picture control.



Cool!
You can reserve a week for your Nugget in this <a href=" http://www.yqcomputer.com/ ;message.id=3194#M3194" target="_blank">thread</a>.  :smileyvery-happy:
Ben
 
 
 

How to drag and drop a picture at run time in a window displaying pictures?

Post by Darre » Sun, 29 Apr 2007 07:10:07

Come on, Ben...for you yourself know perfectly that the day of the Occasional Nugget so comes as a thief in the night.
-D