LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

selecting a string constant from a menu.

I try to make a VI where the user can choose from a list of different "frames" (commands) that he can send to the serial port. In my present version, the frames are represented as string constants. My problem is with the menu. I would like to have a menu and a send button that can be used to select and send messages. How can this be done?
Message 1 of 9
(3,711 Views)

Hi Tzench,

 

when the command list is static you could use an enum and when the list changes on runtime you could use a ring control. The user will see the string, but in the block diagram you get a numeric value (but you can also get the string value).

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(3,709 Views)

Good point about enums and ring controls. How would a ring control help me if I want to change the list in runtime?

 

Still, what about the send button?

0 Kudos
Message 3 of 9
(3,693 Views)

Hi Tzench,

 

ring control values can be changed by property node at runtime, an enum is fixed at development phase.

A "Send button" is easy: take an "OK" button and change the boolean text Smiley Wink

 

First the user selects the command in the ring control, then the send button is pressed...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(3,687 Views)
I've made a kind of ring control from a case structure and an enumerated control. Each case contains a string constant connected to the same wire, going to the VISA. Now where should I connect the button?
0 Kudos
Message 5 of 9
(3,671 Views)

You can use an implicit property node by right clicking the control, going to Create -> Property Node -> Ring Text -> Text

That will give you the text that is displayed on the ring control at that moment.  As to how to make the OK Button trigger an action, I recommend you look into Event Structures.

Message Edited by JeffOverton on 12-05-2008 08:04 AM
Message 6 of 9
(3,663 Views)

Actually it doesn't seem like I can use ring controls the way you describe them in the version of labview that I am currently using. Even the help files only describe them in theoretical terms.

 

The event structure seems very interresting, but I don't completely understand how I'm supposed to use it. Should I put a button in every case (what would that look like on the front panel?)? or a button that is connected to the event structure, or something inside it?

0 Kudos
Message 7 of 9
(3,653 Views)
Ordinarily you have a while loop with an event structure inside it, so that after an event occurs, the loop iterates and the event structure waits for an even again.  In order to set up which events the structure should watch for, right click on the event structure and choose "Add Event Case."  This will let you set up the source and type of an event.  In this case, you want the source to be a boolean button, and the type to be "value change," because when the user clicks the button, the value will change from true to false.  Then, in the event case, you can read your text control (I have to think that any version with events will have rings), and parse it through to whatever you're doing.
Message 8 of 9
(3,651 Views)

Hi Tzench,

 

it seems this will help you a lot an your way to learn LabView! There are 4 free items including a 6h course!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 9
(3,618 Views)