LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set font of all compomnents of a control programmatically

Solved!
Go to solution

Hi community,

 

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!

 

Best regards,

Florian

0 Kudos
Message 1 of 7
(234 Views)

How about something like this? 

 

fontx.png

 

You will need to create Property Nodes for every control and indicator. 

 

 

 

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(188 Views)

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.

0 Kudos
Message 3 of 7
(178 Views)

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.

0 Kudos
Message 4 of 7
(172 Views)

I have been asking for a "Skinning Engine" that could change the color scheme, fonts, and etc. all at once for over a decade.

 

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 7
(170 Views)

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.

0 Kudos
Message 6 of 7
(164 Views)
Solution
Accepted by topic author Florian.Ludwig

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. 🙂

Message 7 of 7
(156 Views)