LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the value that was clicked on in a string array indicator?

I want to open a tdms file out of a folder that contains TDMS files. I have the list of files in a string array indicator. I want to click (or double click) on the indicator and have that file load. I can do everything here except get the value of the cell that was clicked on.

 

I was expecting "Index" to be the index of the cell that was clicked but apparently not. It always stays at zero regardless of what is clicked. When I click my timestamp test does update so I know the event loop is executing.

 

How to get the value of the cell clicked in a string array indicator?

 

Image 18.png

 

Image 19.png

0 Kudos
Message 1 of 6
(1,267 Views)

Hi flycast,

 

in "classic" LabVIEW I would use a listbox instead to show the filenames to the user.

It is very easy to get the active item of a listbox as it is its value…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(1,262 Views)

That seems to be the ticket!

 

Value gives an array of indices depending upon if single or multiple selection mode is enabled. If single then the array only has one value.

 

Image 20.png

0 Kudos
Message 3 of 6
(1,245 Views)

So one more follow up question. How to detect a change in focus from one element to another using the arrow keys?

 

To reproduce:

 

 1) Click in the listbox

 2) Use the arrow key up or down to move to a different row.

0 Kudos
Message 4 of 6
(1,212 Views)

I don't have NXG but on classic, there is a property for Listboxes called Focus Row which seems to be exactly what you want.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 6
(1,206 Views)

@flycast wrote:

So one more follow up question. How to detect a change in focus from one element to another using the arrow keys?

 

To reproduce:

 

 1) Click in the listbox

 2) Use the arrow key up or down to move to a different row.


Once a listbox item is selected, the arrow keys will move the selected entry, thus changing the value of the listbox AND triggering a "value changed" event. No need for properties. (Classic LabVIEW. Have not tried in NXG)

0 Kudos
Message 6 of 6
(1,192 Views)