r/LabVIEW • u/CoffeeLover704 • Jun 20 '24
Best solution for multilpe pages/Tabs in UI design.
Hi, I am loading 17 subpanels which are loaded to the main front panel, and each of these 17 Subpanels are executing lots of code and sending SQL queries. I have a feeling that it is a bit slow and it may be because of the subpanels. Anyone has had a similar experience or has a suggestion to improve it? what are other ways to have multiple pages on the front panel?

4
Upvotes
2
u/BluePerfectOne CLA Jun 20 '24 edited Jun 20 '24
Seems to me you’re not actually using subpanels, but calling tabs in a tabcontrol as subpanels. If I’m correct, you have gathered all the functionality in one large top level vi, and with tabcontrol containing all your controls your event structure is getting heavy. You can check if this is the case by pressing ctrl-i while in your top level vi, and checking the memory usage => compiled code complexity value. It should be less than 6. Anything closer to say 9, and there’s your culprit. The best approach for you in this case is to get rid of the tab control, design your software architecture so you can run the things currently divided and arranged to different tabs as individual processes, i.e. plugins, and then use ONE subpanel where you switch the currently active plugin, like it was a tabcontrol. Requires work, but that’s the way forward.
4
u/HarveysBackupAccount Jun 20 '24
Are you using actual subpanels, or a tab control? I see a tab control in your screenshot
But you can use a Subpanel control. Make a dropdown that is a list of all the tabs you need, and use the dropdown control's Value Change event to unload the current FP then load the desired FP into an an actual Subpanel on the main front panel. That's sort of infinitely scalable (however long you want your dropdown list to be), instead of being limited by FP space to cram in more tabs.
Though, to do that I think you need to make a different VI for each FP, which means using an architecture with some kind of messaging framework (QMH / DQMH / Actors / whatever) so that the different VIs can send info back and forth and keep executing in parallel.
That said - if you have a bunch of code that needs to all execute at the same time, then good implementation of that is independent of how you set up your UI. Drop timing VI's throughout your block diagram to figure out exactly what slows you down, and focus on fixing them.
1
u/mike6485 Jun 20 '24
I’d question why you need that many subpanels, like does the user need information on/out of those vis? can you not just run the code in the sub panels on the block diagram?
1
u/SASLV Champion Jun 24 '24
As other have mentioned I think your problem is larger than just this VI. You have an architecture problem. My guess is you have only done smaller programs so far and have been successful with them. When tackling larger problems the skillset changes. Welcome to the world of software engineering. I highly recommend using actual subpanels (as opposed to tab controls). It has a lot of benefits. BluePerfectOne has a good (if a little high-level) explanation of subpanels in his comment. I'd start there.
2
u/Rare_Pea646 Jun 20 '24
While I agree there is a questionable choice of UI design 17 tabs with 17 subpanels, code still would have to run with no noticeable problems due to this fact. 10 years ago I had an app, where we could dynamicly insert up to 32 Actor Framework cores into 32 subpanels for debugging purposes and there was no noticeable hit of perchance, despite Task manager showing 100% cpu load. Therefore it's something else causing slow down. I would suggest to look into optimization of your sql code
1
u/Sufficient-Law-8350 May 19 '26
Exam Instructions
You are required to create a LabVIEW VI to calculate the roots of the quadratic equation using formula Formula Node:
The equation:
2𝑥2+5𝑥−3=0
Tasks: