LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop handling

Hello,

 

          I'm trying to do create a VI, where in a tab control(find the attached vi) should be visible. Tab control is arranged as to work like a two button dialogue box. 

          working principle : loop should be continues. when I press left navigation key button names 'Yes" should be focused, when I press right navigation key button named "No" should be focused. This is working fine. But when I press Enter key focused button should be on for a moment and tab control should go invisible and the while loop should be stopped. This I couldn't achieve.

          I'm hereby attaching my vi, please go through it and suggest the changes to meet the requirement.

 

 

Thanking you,

sushmith

Thanking you,
Sushmith
0 Kudos
Message 1 of 13
(3,295 Views)

try connecting the loop termination point to a true in the "return" case.

this will solve the problem you discribe.


Learning LabVIEW since January 2013
0 Kudos
Message 2 of 13
(3,277 Views)

You are making this VI way more difficult than it needs to be.

  1. No need for the tab control.  Just set the VI display properties to be a Dialog and size the front panel to only show what you want the user to see.
  2. No need for the local variable with the flag.  Just set the focus inside of the case structure.
  3. No need to check for the Return key.  If a control has focus and you press the Enter or Return key, the control will toggle.
  4. You want an event to handle the Yes button value change and No button value change.  Have a single case handle both events.  With this event, stop  the while loop.

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 13
(3,257 Views)

Hi,

 

this thread seems to be a continuation from that one...

 

Sushmith: why did you create the next thread?

Best regards,
GerdW


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

@GerdW wrote:

Hi,

 

this thread seems to be a continuation from that one...

 

Sushmith: why did you create the next thread?


Oh yes.  With information found in that thread I should add that you have your main VI call this VI.  SubVIs are a great way to reuse code, breaks up code segments, and makes programming so much easier.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 13
(3,246 Views)

Hello GerdW,

 

             In the previous thread I came to know that I have to create a sub Vi which acts as 2 button dialog box. So I paused the perticular task there itself and started focusing on creating a sub vi. 

 

             As I was creating 2 button dialog box vi I faced while loop handling problem and hence I had to ask the people who are having more knowledge in labview. Since the problem was different here i thought of creating a new thread.

 

             As you said creating a SubVI is a basic step in labview, but unfortunately i'm not aware of it and very fresher to labview. Hence I need your support in creating the same.   

 

Thanking you, 

sushmith

Thanking you,
Sushmith
0 Kudos
Message 6 of 13
(3,198 Views)

Hello crossrulz,

 

             Thanks for the vi. Now I would like to use it in my main VI. I got an option to create it as sub vi by going to edit--> create SubVI. I gave an icon like the file attached. 

             

              Default 2 button dialog box will have only 4 ports, i.e I have to connect the string constant to display the dialog required , and two more string constant for the names of 2 buttons. One more will be a output which gives us true or false depending on the  button pressed. I want to use this SubVI like the default 2 button dialog. But the icon i just got after creating SubVI needs me to connect external buttons,reference etc. please help.

 

 

 

Thanking you,

sushmith

Thanking you,
Sushmith
0 Kudos
Message 7 of 13
(3,194 Views)

You can just insert crossrulz VI as a subVI. You only have to insert it in your VI. ( right mouse button on block diagram, select a VI...,  browse to location of crossrulz VI and select it. )

 

I think you need to add the in and outputs to the connector pane. 

 

to quote GerdW from the last topic.


@GerdW wrote:

Hi sushmith,

 

it seems you really should take the online courses offered by NI: here or here. There are even more resources available, LabVIEW comes with a huge example base...


Creating a subVI is a basic step, you really should know how to do that!


I hope this helps you.


Learning LabVIEW since January 2013
0 Kudos
Message 8 of 13
(3,183 Views)

Hello,

 

         Hello I did it.. But how can I control the visibility of the dialog box?? when my condition is met, say I have a button, when the button is pressed then only dialog box should open and once the yes or no button is pressed it should close.. how can I achieve it? 

 

 

Thanking you,

sushmith

Thanking you,
Sushmith
0 Kudos
Message 9 of 13
(3,174 Views)

On the front panel of the message box right click on the icon and select VI properties. 
select in the combobox window aperence and then select dialog. 
Then it will open when you call it and close if the VI is done. 


Learning LabVIEW since January 2013
0 Kudos
Message 10 of 13
(3,167 Views)