08-25-2021 11:39 AM
Hi All,
Is there a more efficient way to perform the attached VI?
Simply, it's push buttons to control tabs within tabs. For this quantity of tabs, this is fine.
Now, imagine there are a lot more than just the 3x2 tabs that are in this VI. How would this be managed better?
If you need anymore information let me know!
Solved! Go to Solution.
08-25-2021 11:52 AM - edited 08-25-2021 12:17 PM
Hi SDuffy,
@SDuffyLV wrote:
Simply, it's push buttons to control tabs within tabs. For this quantity of tabs, this is fine.
Now, imagine there are a lot more than just the 3x2 tabs that are in this VI. How would this be managed better?
It's not even "fine" for this amount of tabs and buttons!
Why do you even need 3 pages with a 2-page tab in each of those pages?
You should start by implementing a better UI than to improve the tab handling (IMHO)…
See this (kind of dirty) implementation using 2 radiobuttons:
(Uhh, the snippet is hiding coercion dots!?)
08-25-2021 04:09 PM - edited 08-25-2021 04:18 PM
You need to learn how to use RADIO BUTTONS!
Properly label your tabs and a simple Event Structure is all you need to change them.
I often get asked why use buttons to control a Tab Control... Well since tabs are like totally 90's GUI design, I like to make "invisible" tabs and have buttons to press to select what tab is displayed. This makes it look like there are no "tabs" but the entire screen is changing instead.
08-25-2021 04:40 PM
A tab (by default) is a control and should be used as such. You are doing the "tail wagging the dog" thing by making it an indicator and setting it externally. In 99.9% of all programs out there people are used to click on the tabs directly to change the view, so why do things backwards?
Can you explain the usage scenario where this makes sense?
And, as others have already said, your code is overly complicated and convoluted. Way too much duplicate code, completely unnecessary code, and way too many local variables. Also, why is there a timeout case? Why is there a 1ms wait in parallel to the event structure?
08-25-2021 05:13 PM
Here's what I might do.
08-26-2021 05:05 AM
Thank you all for the replies.
I didn't realise when making this post that this would be an important bit of information but none of these codes work on the Real-Time Module of LabVIEW.
The codes do work with base LabVIEW, however.
Is this functionality possible with the Real-Time Module? I'm assuming that Reg Events have to be used for this and am currently trying to figure this out.
08-26-2021 05:09 AM
I appreciate the feedback. I understand this has not been a well thought out code, it was just to get the concept across.
1) We don't need 5 cases, you're right
2) I've picked up a bad habit of placing indicators/controls outside of any loops so that they're easily visible in large programs
3) I don't, that was just a stupid mistake
4) I was not aware of the functionality of Radio Buttons, this is a revelation!
5) The Stop button was missed out because it wasn't the main focus of the code, that was laziness on my half, apologies for that.
08-26-2021 07:18 AM
@SDuffyLV wrote:Now, imagine there are a lot more than just the 3x2 tabs that are in this VI. How would this be managed better?
To answer this question, you probably want to break out the functionality so that you have multiple SubVIs that you can call, each with their own user interface. Any more specificity would require some more information about what it is you're trying to accomplish. There's subpanels, custom runtime menus, all sorts of ways to manage that better.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
08-26-2021 08:52 AM
@SDuffyLV wrote:
Is this functionality possible with the Real-Time Module?
The realtime module typically does not have a front panel, so please explain why you are shuffling around UI elements. (see also).
Maybe you should take a few steps back and tell us what you are trying to do, not how you are trying to do it.
08-26-2021 08:57 AM
Hi SDuffy,
@SDuffyLV wrote:
I didn't realise when making this post that this would be an important bit of information but none of these codes work on the Real-Time Module of LabVIEW.
Well, that is an important information about that whole problem…
You should learn to write better questions!
Which RT target do you use? You know most of them don't support UIs at all because they don't support monitors/displays?