LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Pixel coordinates

I need to do some resizing/repainting of some windows, and it would be nice to know (in some cases) the dimensions of a certain control.  I know (for certain items) I can check the properties, but I'm wondering if theirs a mode in labview where it displays the pixel coordinates as I click.
0 Kudos
Message 1 of 7
(4,876 Views)
I don't think such a mode exists, but what you can do is use a Event Structure to get the pointer's position and then compare it to the objects on the panel.

There must be a way to get the list of front panel objects ; get that list, then for each item get its position, and then with the Event Structure wait for a click, get the position where it happened, compare that position to the object positions list and display the position of the clicked object.

hope this helps 😉

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

Epictetus

Antoine Chalons

Message 2 of 7
(4,869 Views)
If you have the option of using the IMAQ Vision package, do so... the standard image display shows pixel coords as you move your mouse over it.
0 Kudos
Message 3 of 7
(4,865 Views)
I'm not sure what IMAQ Vision package is.  When you say 'option' do you mean that IMAQ Vision package is some type of add-on to LabVIEW?
0 Kudos
Message 4 of 7
(4,855 Views)

IMAQ does come for a price, but you don't need it - there are much simpler ways, as shown in the attached.

You can also get a reference to the objects on the FP, as shown.


___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(4,847 Views)

P.S. If it's the dimensions you're after, every control has the bounds property which will give you its exact size in pixels.


___________________
Try to take over the world!
0 Kudos
Message 6 of 7
(4,845 Views)
Sizes of controls are shown in a little pop-up at the bottom of your window as you are resizing a control in the edit environment.  If you need to do this while the VI is running, things get a lot more interesting.  As tst mentioned, you can easily get the current size using the Bounds property.  However, there is no global method to resize a control.  For example, to resize a graph, you resize the plot area.  All controls have some programmatic way to resize them, but it won't necessarily be obvious.  To show size during run-time, the easy way is to create a front panel control with the information on it.  You can hide and show the control with the Visible property.  Alternately, you can create a custom dialog to show the size and customize to your heart's content (look at Window Appearance in the VI properties).  Get the mouse information you need with the Mouse Down, Mouse Up, and Mouse Move events.  You will need to make heavy use of the event structure.  Pulling this off will require a bit of work, but it is possible.
0 Kudos
Message 7 of 7
(4,827 Views)