LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure, multiple controls and reference suggestion

Examples

 

Hello,

 

I want to make a suggestion.

 

I often want to use 2 or more controls to trigger the same event, because sometimes the code for one control is only slightly different then for the other control. An example of this is a motor that turns left when a positive speed is entered and right when an negative speed is entered (See Example 1). To make sure my code will stay simple to read, I can easily "group" them in this manner (as in not coding 100 nearly the same events).

 

Please keep in mind that these are simple examples. For my coding I have to do more then just entering a constant. I have to do complex calculations for one control, maybe read a sensor for another and do nothing for a third. So here it is mustly not possible to use sub-VI's.

 

My suggestion is to make it possible to wire the control-reference from the event structure to a case-structure (See Example 2). This is not possible at the time. I managed program a decoder to find out what control was activated. But it feels dirty and takes away a lot of space. Being lazy, it would be great if NI could make it so that the Case-Structure would automaticly list all possible control-references.

 

Hope you guys understand what I mean. Study the 2 examples, I think they will make it clear. 

Thank you.

 

Regards,

Heinen 

 

Message Edited by Heinen on 08-31-2009 09:08 AM
--------------------------------
The Enrichment Center is required to remind you that you will be baked, and then there will be cake.

0 Kudos
Message 1 of 10
(5,818 Views)

An option is to read the label of the control, this should never change.l

Another option is to create an array of references and do a 'find in array' the returned index tells you which control was used.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 10
(5,810 Views)

A better solution for the case on the right would be to create an array of the releveant references outside the loop and then use search array with the output index wired to the case structure.

 

Wiring a control reference to a case structure is an interesting idea, but I have not really thought about it in detail. Maybe you can post it as a new idea over in the LabVIEW Idea Exchange.

Message 3 of 10
(5,808 Views)

I running into the same issue now and then, but had a different solution in mind. With this idea you would get a cluster or an array of booleans for your example, which you could convert to a number and wire to the case structure. Would be grateful to hear your thought on this:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/New-event-data-element-for-value-cluster-of-registere...

0 Kudos
Message 5 of 10
(3,544 Views)

Just put the buttons in a Radio Buttons cluster that allows No Selection.  Then do this:

rb.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 10
(3,520 Views)

I love the radio button! But it has the limitation that it groups your buttons together on the front panel. You lose the ability to place them anywhere.

0 Kudos
Message 7 of 10
(3,512 Views)

@mike-o-tronic wrote:

I love the radio button! But it has the limitation that it groups your buttons together on the front panel. You lose the ability to place them anywhere.


Well then try nested event structures:

ne2.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 10
(3,483 Views)

@paul_cardinale wrote:

@mike-o-tronic wrote:

I love the radio button! But it has the limitation that it groups your buttons together on the front panel. You lose the ability to place them anywhere.


Well then try nested event structures:

ne2.png


I'd be scared to suggest that to just about anybody.

0 Kudos
Message 9 of 10
(3,470 Views)

@RavensFan wrote:

@paul_cardinale wrote:

@mike-o-tronic wrote:

I love the radio button! But it has the limitation that it groups your buttons together on the front panel. You lose the ability to place them anywhere.


Well then try nested event structures:

ne2.png


I'd be scared to suggest that to just about anybody.


It's not hard to get this one right, and it's easy to check.  If you get it wrong, it will sieze up; then just abort, fix and retry.  In my opinion, this is a very good solution to this particular problem.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 10 of 10
(3,434 Views)