LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you select an item from a table indicator with a mouse click and then use that selection in code?

Hi,

 

I am displaying a list of filesfrom a directory  in a table on the front panel of a VI as part of a program I am developing. I would like the user to be able to select from that table so that particular file can be processed. Is there a way to do this?

 

Thanks,


Aaron

0 Kudos
Message 1 of 8
(3,481 Views)

you'll find that most of the useful functionality of the labview user control interface is hidden within the property node and invoke node functions. just right click a control or indicator terminal on the block diagram and mouse over to create, then to property node or invoke node. lots of fun stuff in there. attached is an example. one file is saved for labview 8.0, the other is saved for labview 8.6.

 

Message Edited by Root Canal on 10-16-2008 11:17 AM

global variables make robots angry


Message 2 of 8
(3,470 Views)

The example posted gives you an idea. A few points regarding the example:

 

  •  The sequence structure is not necessary. Data dependency already exists between the file dialog and the loop, and you can force data dependency between the button's property node and the file dialog by using the error cluster.
  • A while loop that acts as a user interface should always have a delay. Otherwise you have a greedy loop.
  • A better way to write the VI is to use an event structure. This will also allow you to use the button in its normal default action, and you eliminate the greedy loop issue.
Message 3 of 8
(3,444 Views)

Thanks, smercurio. That code is much nicer. But you left that suspicious-looking unused control terminal just loitering around where it could get up to no good. I went ahead and implemented a harsh but necessary measure to make sure the situation is properly contained.

 

Message Edited by Root Canal on 10-16-2008 01:44 PM

global variables make robots angry


Message 4 of 8
(3,434 Views)

Two options:

 

1) Easier one. 

Go to function pallette:

- File I/O

- File Constants

- Path Constant

 

Right click on that constant, press "change to control"

Then go to your block diagram. Next to the path, there should be a small manilla folder. The user can press that and browse for whichever file they would like to process.

 

2) Harder one.

I would use an event.
When the mouse is clicked, it will read the value of whatever is clicked.

 Click

Kind of like the above 

Message Edited by Cory K on 10-16-2008 01:47 PM
Cory K
0 Kudos
Message 5 of 8
(3,432 Views)

Root Canal wrote:

Thanks, smercurio. That code is much nicer. But you left that suspicious-looking unused control terminal just loitering around where it could get up to no good. I went ahead and implemented a harsh but necessary measure to make sure the situation is properly contained.


Well, if you feel that strongly about it you can place the terminal in the event case and wire to the terminal instead of the NewVal node. Smiley Very Happy Smiley Wink

Message 6 of 8
(3,428 Views)

Nah, I prefer to torture the little icons.

They know what they've done. Smiley Happy


global variables make robots angry


Message 7 of 8
(3,418 Views)
This was one of the strangest.... but funniest threads I have read in a while.
Message Edited by Cory K on 11-07-2008 03:35 PM
Cory K
0 Kudos
Message 8 of 8
(3,311 Views)