02-01-2012 01:55 PM
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
Solved! Go to Solution.
02-01-2012 02:07 PM - edited 02-01-2012 02:09 PM
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.
02-01-2012 02:14 PM - edited 02-01-2012 02:15 PM
Opps. Need to read the post. Just saw the snippet.
02-01-2012 03:33 PM - edited 02-01-2012 03:41 PM
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.
02-01-2012 05:00 PM
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.
02-01-2012 05:21 PM
Try something like this. (Also attached in LV8.2)
02-02-2012 08:03 AM
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.
02-02-2012 08:50 AM
OK, that did it. Thanks!