LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display x number different user messages

Solved!
Go to solution

Is there a way to display 2,3,4... different messages in the same string indicator at  different times??  I've designed a GUI w a specific area to display to the operator directions.  ie "plug in power supply..click OK to continue."  They click OK.  Now in that same designated space I want to display ie "turn on power supply..click OK, the same OK button from the 1st step, to continue. "  would this be a do while loop or a event structure??  If an event struct how does it know which time the OK was hit?  The 1st or the 2nd or...

I don't want to use a dialog box.

Thanks

0 Kudos
Message 1 of 9
(2,725 Views)

Easy with a state machine. Look here to get started. Attached is an example of a very simple state machine type thing that will do what you are asking.

 

 

=====================
LabVIEW 2012


0 Kudos
Message 2 of 9
(2,714 Views)

The attached example includes two of the most hated elements --- sequence structures and local variables.  However, in this case, they work perfectly well.

 

One thing to keep in mind is that an "OK" button usually has a latch action, meaning it acts as a momentary switch.  This is not compatible with local variables, so you have to change it to be a toggle switch and then programatically reset it after each step.

 

 

0 Kudos
Message 3 of 9
(2,708 Views)

This example shows how to do it using a loop structure where all the instructions are in an array.

 

The nice thing about it is you avoid using both the sequence and the local variables.  It also makes it very easy to add more instructions.

 

The disadvantage is that it is somewhat limiting in how it works with other code elements.  Because it's a loop, it executes the same code each time it goes round.  That works well if you just want to display instructions... but if you want to run different subVIs after each process step, it's difficult.  You can accomplish that, if you like, using a case structure on the iteration value, but it gets a bit cluttered.

 

 

 

 

0 Kudos
Message 4 of 9
(2,707 Views)

The State Machine example is in LV 2011...I have...of course LV2010.  I think the example LandBelenky sent might work.  I just have to see how it will behave w other code.  After I posted I continued searching in the Discussion Groups looking for a vi that would count the number of times a button was pushed.  I found one.  With that I put it w a case statement.  If the button was pushed the 1st time it displayed "plug in PS".   Then the 2nd ...."turn it on".  Third.."do instruction three"  My gut feeling tells me this isn't very robust even though from the on set it appears to work.   I like LandBelenky's solution with the caveat I haven't tried it in my code yet.

 

Thanks.

0 Kudos
Message 5 of 9
(2,684 Views)

Unless I'm doing something wrong this doesn't work in an event structure.  If I click run then "Initial Setup" then the "OK" button, it hangs up.  If I use the highlight exexcution it just keeps constantly monitoring the OK button inside the inner loop of event Initial Setup.  I'm guessing w an event structure it only looks at the event 1x so if there is a conditional loop inside it that particular event it never sees it after the 1st time.  I thought that once it "entered" the event it would execute everything inside it.

0 Kudos
Message 6 of 9
(2,663 Views)

Duh..sorry.  Forgot attachment.

 

 

0 Kudos
Message 7 of 9
(2,662 Views)
Solution
Accepted by topic author MarkDavid

The reason it is hanging is because the event structure will lock the front panel until a triggered event case has completed. Your "Initial Setup" event case is triggered by the Initial Setup button. It locks the front panel until the case has completed. However you have a while loop that stops when the OK button is pressed. You cannot click on the OK button because the panel is still locked.

 

If you click on Events Handled For This Case you can unselect the Lock front panel (defer processing of user actions) until this event case completes.

 

One suggestion is to put the boolean controls with latching action inside the event case that handles them. Doing so will reset the state when the event case fires.

 

 

=====================
LabVIEW 2012


Message 8 of 9
(2,648 Views)

Nice !!  Thanks!

After I posted I continued to search the Grp and found another post that recommended placing the ..boolean controls inside the event.  Which I did.

 

Again, thanks. 

0 Kudos
Message 9 of 9
(2,639 Views)