LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can front panel decorations be dragged by the user?

Solved!
Go to solution

I have an application that prints a label on a Zebra printer. Sometimes we need to adjust the vertical and horizontal alignment of the text on the label. Right now we use entries in an INI file to set the left and top locations. Is it possible to have front panel decorations be dragged around by the user and derive from them the new left and top locations?

 

Tay

0 Kudos
Message 1 of 8
(2,737 Views)

Try something like this. (Also attached as 8.2)

 

As for dragging, what you would have to do is read the position and size of the decoration. In a mouse down event determine if the mouse was clicked on the decoration. Move the decoration with the mouse move event. You cannot create an event for a decoration.

 

Example_VI_BD.png

=====================
LabVIEW 2012


Message 2 of 8
(2,733 Views)

Opps. Need to read the post. Just saw the snippet.

0 Kudos
Message 3 of 8
(2,725 Views)

Got it pretty close, but one little issue. When the operator clicks inside the picture box, the string control jumps to the mouse location and the prior location is lost. If I want to make a small adjustment, this is hard. I think I need to use a shift register to remember the original location, but how do I increment the position of the string control without it jumping to the current mouse location when the mouse button is clicked to move it?

 

 edit - noticed that the snippet is different from my code - the pict refnum should not exist and the input to that property node should be from the Index Array wire coming into the For Loop.

0 Kudos
Message 4 of 8
(2,709 Views)

Yes, you need a shift register. I would use an event structure. On mouse down store a true in a boolean shift register, and on mouse up change it to true. In the mouse move event check if the mouse down boolean is true and if so store the mouse position in a shift register. Each time the mouse move event fires move the control by the delta between the previous and current mouse position.

 

I thought you wanted to move a decoration. It is easier for a control since you can have these mouse events for the control.

=====================
LabVIEW 2012


Message 5 of 8
(2,693 Views)
Solution
Accepted by topic author elrathia

Try something like this. (Also attached in LV8.2)

 

Move Indicator_BD.png

=====================
LabVIEW 2012


Message 6 of 8
(2,691 Views)

Looking at my original post, I did say decoration. So you were right in what you were thinking. Not sure why I said that. Anyway, I will look over your post and get back to you.

0 Kudos
Message 7 of 8
(2,667 Views)

OK, that did it. Thanks!

0 Kudos
Message 8 of 8
(2,654 Views)