is there a way to programmatically set all fonts in a control?
For example to set the caption and the boolean text of a button to be displayed in Arial simultaneously.
You can do that manually by simply selecting the control and using the font dialog, but I cannot find the corresponding property or invoke method and my internet search was unsuccessful.
If this isn't possible (although the editor knows how to do it under the hood) I could always try and make a VI that determines the exact control type and sets all fonts, one after another - but that sounds like a lot of work and error prone.
Maybe there is an unpublished VI in some library?
Any input would be appreciated!
Solved! Go to Solution.
How about something like this?
You will need to create Property Nodes for every control and indicator.
Sure this works for that control.
What I should have mentioned from the start:
I want to do this with hundreds of controls, ideally without having to know the type of the control.
Yes, you just make an array of all of the references you want, then feed them to a For loop with a property node that sets the font.
If you don't want to generate that array manually, you can open a reference to the front panel and get all of the objects in it. If you only want to set all of the, say, Boolean controls, then use a To More Specific Class to try casting it to a Boolean control refnum. If that errors, then it's not a boolean, so ignore it. If it works, then set the fonts.
I have been asking for a "Skinning Engine" that could change the color scheme, fonts, and etc. all at once for over a decade.
That's what I was afraid I had to do.
Getting the array is the easy part - thinking of all the control types that can come up is the hard part.
Thanks for the input guys.
Here's an old VI I have (saved in LabVIEW 2014) that reads the fonts of all text parts of a control. This code pre-dates some control types in LabVIEW, like Sets and Maps, so it may not account for newer control types, and there are some known shortcomings (see the comments in the 'Table' and 'Multicolumn Listbox' frames, e.g.), but it's probably the best start you're going to get for writing code that sets the fonts of all possible control parts. 🙂