LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to drag and drop objects (e.g. buttons) in run mode?

Hi all,
 
Is it possible to create an application with LabView where I can go with mouse on a button and drag the button somewhere else?
 
I tried to do it with mouse down event with no success.
 
 
Regards,
Matias
0 Kudos
Message 1 of 9
(4,212 Views)
Hello Matias,

I would be very surprised if it is possible Smiley Indifferent...

What you can do is programmatically move a button using a property node, see attached in LV 7.1

hope this helps 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 9
(4,197 Views)

Yes if you are trying to move a button with drag and drop during execution, it is not trivial.  You will have to register and unregister events dynamically. If you want to create new buttons in run time then you are out of luck (outside of scripting).  But I have done this where you can move existing controls during execution.

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 3 of 9
(4,192 Views)
Matias,
if i understood your question right, than you will find an example on your pc!
Open NI Example Finder, navigate to "Search" Tab and type "dynamic".
Afterwards choose the Vi "Dynamically Register for Events".

Hope this helps!
ThSa
Message 4 of 9
(4,187 Views)
Good idea Paul ! I haven't thought about that... maybe also with event case, if the mouse-down on the button, the button's position follow the pointer's position. That requires a vi to get the pointer's position, I'm sure it exists, no ?


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 5 of 9
(4,183 Views)

Sorry I didnt finish explaining: on "mouse down?" for a particular button register for the "mouse move" event, in the mouse move event you update the controls position with the coordinates of the mouse and on the "mouse up" event unregister for the mouse move event.  This enables a button to follow the mouse move event but only if it is between a buttons mouse down and mouse up event.  Even nicer you can bound the mouse down event to unly work if you double click or have some platMods or other mods selected, which gives you even finer control over the operation of the events.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 6 of 9
(4,180 Views)
See the example "Dynamically Register for Events.vi"


LabVIEW, C'est LabVIEW

Message 7 of 9
(4,179 Views)

Thanks a lot for all of you! That example really shows how to do it. Not so simple way but I think good enough.

 

Regards,

Matias

0 Kudos
Message 8 of 9
(4,133 Views)

FYI, I have used a very similar code with picture boxes to simulate some laso/ highlight region tools.  This model of a dynamic event registration where you can isolate mouse move events between clicks allows for very powerful control over an application's GUI.

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 9
(4,122 Views)