LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When the save button is clicked I want everything to reset and go the Show Item1

Solved!
Go to solution

Hello guys,
Here is a simplified example of my application.
The user has to answer the 6 questions and the 3 radio buttons comparisons. He clicks on the next button to go to the next step.
What I can't do: when the save button is clicked, I want to return to the Show Item1 (question 1) state, as shown in the image below.
How do I do this?
Thanks in advance

0 Kudos
Message 1 of 9
(1,894 Views)

Hi ngouda,

 


@Ngouda wrote:

What I can't do: when the save button is clicked, I want to return to the Show Item1 (question 1) state, as shown in the image below.


There is no "save button" in your image…

 

On the other hand: when your Vi consists of a state machine then it's quite easy to go to the desired states!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,890 Views)

HI GerdW,
It's normal that the save button isn't in my image.
The save button is available in the last question.
the image I sent is the first question. By clicking on the save button, I want to be able to return to question 1.
Have you seen my vi?
I guess it's easy, but I can't figure out how to do it.

0 Kudos
Message 3 of 9
(1,878 Views)
Solution
Accepted by topic author Ngouda

hi 


You just need to output the shift register to Show item 1. 

LVNinja_0-1688045000986.png

Alternatively you can create another state called "Init" that is executed in the beginning of the program that "reset" all controls to a desired state then goes to "Show item1". 

So when click SAVE it will direct to the "Init" state , reset everything and go to "Show Item 1".

The state machine diagram would look something like this 

LVNinja_1-1688045760726.png

 

One suggestion: Replace "CANCEL" for "BACK"

 

LVNinja_2-1688045814232.png

 

 

Message 4 of 9
(1,873 Views)

I spent too much time trying to understand why/how you wrote such a complex "check the many boxes" hard-coded routine whose real workings I was having a difficult time understanding.  I even tried running it, and couldn't figure out what I was doing and what you were measuring.  But then I looked again at the title, and said "Oh, simply have the Save case put "Show Item1" back on the Shift Register, but LVNinja beat me to it.  Kudos to the Ninja!

 

Bob Schor

Message 5 of 9
(1,850 Views)

Hi LVNinja,
thank you for your reply. Yes indeed it was easy, thank you very much for your answer, your explanations and suggestion...
It works as I wanted now.
When the stress is there, it's hard to see well 🙂

Message 6 of 9
(1,844 Views)

Hello Bob_Schor,
Thank you for your reply.
Is my code difficult to understand? I haven't coded well?
I'd like to know how to simplify it so that someone can easily understand my code.
If it was you, how would you proceed?
Thanks

0 Kudos
Message 7 of 9
(1,838 Views)

The way you did it works ! that's what matters. 

However if you are curious on how to make things easier, you can explore using TAB Control, then you add the controls on each tab. When you click "NEXT" you just change the tab that is visible, so no need to make the visible/invisible logic (that you brilliantly implemented btw).

It's a easy way to implement "wizard" type of user interface.

Message 8 of 9
(1,810 Views)

Dear LVNinja,
Thank you very much for your feedback 🙂
C'est gentil.
I'm going to read up on the use of TAB Control over the weekend.
Bonne soirée
Sincerely

Message 9 of 9
(1,801 Views)