LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean button controling tabs

Solved!
Go to solution

Hi,

 

I'm using LabView to run an HMI, and I currenlty have tabs with different pages for certain aspects of the HMI. I have a home page right now with most of my system on it, and I want to open tabs by clicking on objects on my homepage.

I have tried programming this by using case structures and local variables, but I find that LabView is becoming quite glitchy when I do this, and I think it has to do with the local variables, as I hear they can cause problems when over used.

 

Does anyone know of a better way that I can create a boolean button that will take me to a specified tab?

 

When LabView was giving me trouble I had a transparent button over a series of indicators to go to the tab. This may have also been causing problems.

 

Thanks

 

0 Kudos
Message 1 of 10
(3,323 Views)

Where are the buttons and where are the tabs? Are the buttons on one of the tab pages?

 

Yes, you don't need any local variables. Show us some code....

0 Kudos
Message 2 of 10
(3,317 Views)

Here is an example of what I mean.

 

This is obviously not my actual HMI, but these buttons are just what I need in my HMI. They are working now, but can I do them without using local variables?

0 Kudos
Message 3 of 10
(3,311 Views)

Try something like this:

 

 

0 Kudos
Message 4 of 10
(3,309 Views)

@softwarestudent wrote:

They are working now, but can I do them without using local variables?


All your buttons should be set to "latch when released" (right-click..mechanical action). This eliminates the boolean local variables: they will reset after they have been read by the code once.

Your loop needs also a small wait.

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

This was really helpful, but the only thing is I also want to be able to get to the pages by using the tabs at the top of the page aswell. Will I need to make one local variable for that, or is there any other way?

 

Here is what I have so far, and it is acting how I would like, but can I do it without the one local variable?

0 Kudos
Message 6 of 10
(3,283 Views)

You might want to add another event for when the user changes the tab value.  Other than that, I think you are stuck with the local variable.


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 7 of 10
(3,277 Views)
Solution
Accepted by topic author softwarestudent

Yes, that looks almost OK.

 

You should also create an event for "tab:value changed" and feed the new value also into the shift register. This way the SR and tab value are always consistent. If you don't do that and you have other event cases, the tab would reset to the SR value whenever another event fires.

 

You could also eliminate the shift register and simply wire to a local variable in the boolean event case. If you do this, you might want to force page 1 upon program start.

0 Kudos
Message 8 of 10
(3,276 Views)

Now that I think about it, why not just put the local variable inside of the event case.  Then you don't need the extra event for "tab:value change" or the shift register.


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 9 of 10
(3,272 Views)

Yes, that's what I said in the second part above.

 

The shift register is convenient if the tab is an indicator AND you need access to the tab values occasionally in the code.

If you want to operate the tabs, it needs to be a control. A control can be read directly by the code wherever it is needed.

0 Kudos
Message 10 of 10
(3,266 Views)