05-17-2012 05:16 PM
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
Solved! Go to Solution.
05-17-2012 05:39 PM
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....
05-17-2012 06:10 PM
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?
05-17-2012 06:15 PM
05-17-2012 06:37 PM
@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.
05-18-2012 09:27 AM
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?
05-18-2012 10:48 AM
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.
05-18-2012 10:53 AM
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.
05-18-2012 10:59 AM
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.
05-18-2012 11:12 AM
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.