LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous actions in the User Interface

Solved!
Go to solution

Hi!

 

Thank you! i understand it much better now!

 

Have a nice day!

0 Kudos
Message 11 of 17
(688 Views)

Hi!

 

I just have another question for you. As you said, I should not use event with sequential structure, I am now trying to rebuild my code with using shift registers and events. However, I have quite many buttons and indicators.

Do you suggest me to create a shift register for each one and then in the timeout create several case structures as you did to show what happens?

The problem is that all of these buttons execute respective actions in a strict sequence, hence this is why i wanted to use the sequence structure.

 

Best regards

 

Mirela

0 Kudos
Message 12 of 17
(673 Views)

Hi Mirela,

 


@mirelche wrote:

The problem is that all of these buttons execute respective actions in a strict sequence, hence this is why i wanted to use the sequence structure.


When you want to execute certain actions in a defined order you should think  of a statemachine…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 17
(666 Views)

@mirelche wrote:

I just have another question for you. As you said, I should not use event with sequential structure,


You shouldn't (need to) use a sequence structure at all.

 

Ideally, sequence is either irrelevant (so why force it), or forced by dataflow. There are hardly situations where order is relevant, and there's no dataflow. If this happens, a flat sequence structure (never a stacked one) can seem convenient at first, but not in the long run. And they're always avoidable, with a tiny bit of work.

Message 14 of 17
(656 Views)

wiebe@CARYA wrote:

@mirelche wrote:

I just have another question for you. As you said, I should not use event with sequential structure,


You shouldn't (need to) use a sequence structure at all.

 

Ideally, sequence is either irrelevant (so why force it), or forced by dataflow. There are hardly situations where order is relevant, and there's no dataflow. If this happens, a flat sequence structure (never a stacked one) can seem convenient at first, but not in the long run. And they're always avoidable, with a tiny bit of work.


I think a sequence structure is "allowable" in this one situation: Where you are reading from or writing to a variable and you need to make sure that the read or write happens exactly when it is supposed to.  Even then, technically you could make a subVI to do this, but I will allow sequence structure laziness to avoid the creation of a subVI just for that one purpose.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 17
(645 Views)

Hi,

 

this is actually what i need to do. My Vi has many tabs and in each tab there are buttons. These buttons actuate usually a series of actions, eg start sensor logging, or wait 10 second with a countdown and then send signal to a LED.

Initially, I had sequences and events with the buttons inside, and it was functional, except for the problem which i had that while a countdown is running, then i cannot actuate the stop button, for instance.

So what would you recommend me? I am a bit confused, now what i have done is just started using shift register and events and cases instead of sequences, but I think there it is much harder to represent for instance a series of 10 things which need to happen in a certain order after a button is pressed.

0 Kudos
Message 16 of 17
(642 Views)

Hi Mirela,

 


@mirelche wrote:

My Vi has many tabs and in each tab there are buttons. These buttons actuate usually a series of actions, eg start sensor logging, or wait 10 second with a countdown and then send signal to a LED.

 Tabs are irrelevant from the block diagram point of view: all you need are the terminals and events for your UI elements.

 

I think there already was a suggestion to implement a producer-consumer scheme. The event handler loop would be the producer, while one or more consumers would execute your "series of actions"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 17
(630 Views)