LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Array Index from current Cursor Position ?

Is there a way to tell what element in an array has the cursor?
I want to put the cursor on any (1D) array element, then hit a button to delete it. Thus, to do so, I need to determine the index from the cursor position.
Richard






0 Kudos
Message 1 of 3
(6,092 Views)
The basic idea is to calculate the index value by subtracting the element position from the array position, and dividing by the element size.
Of course, the result depends on the array disposal (horizontal or vertical ?) and on the the visible of the label/caption and index display. Using the rounded max value should take care of that if the label is in its usual position.
Don't forget to take into account the array index value and you are nearly done : thinks are more complicated if there is an element gap... 😉
 

Message Edité par chilly charly le 12-18-2005 06:45 AM

Chilly Charly    (aka CC)
Download All
Message 2 of 3
(6,089 Views)
Thanks Chilly. Of course! I didn't think about the position nodes, I just thought there should be an "Active Index" similar to "Active Cell" in other controls, but not so with plain old Arrays. I was able to use a much simplified version of your diagram, as shown in the attached photo.
Thanks again, great answer.

(p.s. the Constant 26 in my diagram is the array element's height)



Richard






0 Kudos
Message 3 of 3
(6,071 Views)