LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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 on the front panel. The main thing is that the window is displaying frames continuously?
0 Kudos
Message 1 of 12
(3,804 Views)
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
Message 2 of 12
(3,787 Views)

Hi Chris,

I am using Labview 8.0. I want to drag any simple picture like a circle of diameter 1 cm and i want to drag it to a picture control indicator. But in that i am displaying some frames continuously changing.

Actually I am trying to show a car window which is closing and i hav shown this closing operation by displaying different frames having different glass position in the window. Now what i want is that user can put any obstacle in the window at run time and the window stops at that time and for this i am requiring to drag any object to the window. Then I will find the coordinates of the dragged object and so i can stop the window.

0 Kudos
Message 3 of 12
(3,765 Views)
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 (http://forums.ni.com/ni/board/message?board.id=170&message.id=212920). It might prove useful.
 
Good luck!
 
 
Chris C
Message 4 of 12
(3,750 Views)
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
Message 5 of 12
(3,745 Views)
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
 
George Zou
0 Kudos
Message 6 of 12
(3,743 Views)
Thanks 2 U all
 
I will try it n come back 2 u
 
vivman
0 Kudos
Message 7 of 12
(3,723 Views)

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
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 12
(3,716 Views)

I agree with Ben.  Drag and Drop functionality can be key to creating tutorials and lots of cool interactive stuff.  We used drag & drops all the time using the QuestNet authoring tool for creating interactive courseware CDs for radar maintenance personnel (during my previous life in the Air Force).  For example, we would put test probes on the side of the picture, and the student would have to drag the probes to the appropriate test points to get through each screen or task.  Or we might have cable images sitting there that had to be put on the correct connector on the equipment.  Of course the background of the cable/probe images was transparent so it looked like you were really handling a probe.  It was pretty cool.

I'd definitely like to see some good drag & drop examples.

0 Kudos
Message 9 of 12
(3,711 Views)

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

Message 10 of 12
(3,706 Views)