05-01-2023 03:31 PM
I develop on a standard FHD monitor (1920x1080) but now I want to run it on a higher resolution screen, probably a 4k TV. I know LabVIEW's reputation for failing to accommodate different screen sizes, scaling, and DPI. But most of that is based on forum discussions from 5+ years ago when 4k was more rare.
What is the best practice for putting a LabVIEW program on a 4k display these days?
I'd love to hear how you handle this, even better if the display compatibility issues are fixed in newer versions of LabVIEW (I'm using LabVIEW 2020).
Thanks,
Dan
05-02-2023 06:33 AM
What about making a couple of GUIs for different sizes and start them depending on resolution? It would ofc require you to have a really decoupled GUI. Within smaller resolution changes you can have scaling so e.g. one from 720p - 1440p and one for 1441+
05-02-2023 06:43 AM
Yes, my GUI is nowhere near decoupled that I could easily drop-in 1080 vs 4k scaled displays. Any good tips on how to get that amount of decoupling? All my Event Handlers are on the Front Panel's Block Diagram and I haven't found a good way to decouple that without adding lots of code complexity routing references everywhere which gets confusing.
But I should clarify, my original question isn't how to switch between 1080 and 4k necessarily, although it'd be nice if it's automatic. I'm not even sure how to make a single 4k-capable LabVIEW GUI. Even if I make all the objects large, the components (like borders or up/down arrows) will still be microscopic, right?
05-02-2023 07:28 AM - edited 05-02-2023 07:29 AM
There is concept called Model-View-Controller, that allows you to decouple UI from Business logic.
https://devs.wiresmithtech.com/blog/mvc-in-labview-library/
05-02-2023 08:24 AM - edited 05-02-2023 08:28 AM
@OneOfTheDans wrote:
I develop on a standard FHD monitor (1920x1080) but now I want to run it on a higher resolution screen, probably a 4k TV. I know LabVIEW's reputation for failing to accommodate different screen sizes, scaling, and DPI. But most of that is based on forum discussions from 5+ years ago when 4k was more rare.
What is the best practice for putting a LabVIEW program on a 4k display these days?
- Set the 4k display to 1920x1080 mode?
- Configure the OS to 200% scaling?
- Write the LabVIEW GUI on a 4k display, making all controls huge, and scaling font to like 36pt?
I'd love to hear how you handle this, even better if the display compatibility issues are fixed in newer versions of LabVIEW (I'm using LabVIEW 2020).
4) Why do you need to make your window full screen? Just make it in whatever size that seems practical. If you want to go very fancy you can start looking into letting the user resize the window. If you use panes for different areas of your front panel, you can configure them in which direction (if any) they should resize with the overall window.
As to scaling of screens, that is generally a bad selection. It doesn't even work cleanly in Microsoft applications, although they do generally not have the same kind of mix and match between text controls and other stuff as you see in LabVIEW. As long as it is all just text, the pretty limited text scaling of Windows doesn't really matter, but it gets a pain in the ass if you mix text with other non-text elements that have different scaling rules than what Windows wants to do with text.
Text on a 200% scaled display is not double the height and double the length of the original but something else, also depending on the selected font. Either LabVIEW tries to scale the text box boundary around the text or it ends up cutting off part of the text. But if it scales it according to the contained text it messes up other alignment with other elements. It's a true catch 22 with no clean solution.
05-02-2023 10:35 AM
@OneOfTheDans wrote:
Yes, my GUI is nowhere near decoupled that I could easily drop-in 1080 vs 4k scaled displays. Any good tips on how to get that amount of decoupling? All my Event Handlers are on the Front Panel's Block Diagram and I haven't found a good way to decouple that without adding lots of code complexity routing references everywhere which gets confusing.
But I should clarify, my original question isn't how to switch between 1080 and 4k necessarily, although it'd be nice if it's automatic. I'm not even sure how to make a single 4k-capable LabVIEW GUI. Even if I make all the objects large, the components (like borders or up/down arrows) will still be microscopic, right?
You're right. Just scaling stuff will create lots of issues. So either you'll have to create scaling code to move and scale stuff (or tweak the auto function, maybe just scale the fonts) or create a couple of 'reference size GUIs'.
If you imagine a standard Producer/Consumer where the Producer is the GUI and the Consumer sends information back via a user event, they can be separate VIs and any GUI/Producer can be spawned, that was my thought.
05-02-2023 10:54 AM
I've heard about MVC but never known how to really implement it, especially in LabVIEW. Thanks santo for sharing those references, I look forward to learning more about this design pattern!
rolfk & Yamaeda, it's not that I want the application to be full screen, or even dynamically switch between FHD and 4k (although that would be very convenient). It seems LabVIEW fundamentally doesn't support 4k displays. Even if I manually make everything (fonts, text boxes, etc.) 4x larger, there are pieces of LabVIEW that do not scale. For example the Graph Palette will be much smaller on a high resolution display. All these little things add up to a pretty bad GUI, and of course a lot of extra work to make everything huge.
Thanks for the caution about using 200% scaling & text as that was my leading plan. At this point it's sounding like LabVIEW simply doesn't support higher resolution displays, and my best bet is to change the display to FHD at 1920x1080.