From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to batch-change the font size of many listbox item names at once?

Solved!
Go to solution

Hello Labview specialists
I do use many listboxes on a front panel and populate them using the item names property node.
As I want my front panel objects to adapt to the current monitor resolution I have tick the 'Maintain proportions...' and 'Scale all objects...' options in VI properties. I also use a VI Property called Controls[] to set the Label.FontSize.
The problem is that those do not seem to impact my listbox item names and I am forced to individually use  the Caption.FontSize and Label.FontSize property nodes which is awfully time consuming to program (in my case).
Has anyone found a trick to avoid going individually through this process?
Thanks a lot for all your suggestions
Christophe

0 Kudos
Message 1 of 15
(4,147 Views)

1) you use item names property node every time rescaling or at the start? If first, you spend too much time for searching.
You can make cluster or array of links and use it.
2) use defer update property (for details see help)

defer.png

0 Kudos
Message 2 of 15
(4,119 Views)

Also, if you want to change all rows at once, set active row to "-2".  This will set the fonts all at once, including the Column Headers.  But you can always change the headers back afterwards if they are different.  This is a lot faster than looping through the rows.

 

Listbox Font.png

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



Message 3 of 15
(4,114 Views)

Hello

I am rescaling only when entering the panel and use the ActiveRow=-2 method. Nevertheless I was hoping there existed a method to program a rescale of all my 50 ListBoxes at once.

Like the Panel/Controls[]/Label.FontSize that I use for labels (Controls[] gives me an array of Controls that feeds a for loop to change the Label.FontSize).
But I cannnot find anything to give me References type of all ListBoxes of my panel...

0 Kudos
Message 4 of 15
(4,096 Views)
-How much time it is consuming?
-Could you create sample of your vi and post vi/snippet?
-I believe setting active row to -2 is the best way to set properties of all elements in listbox similar to multicolumn list box.
http://digital.ni.com/public.nsf/allkb/E7F5399568557C9086256AAF0063FFD8?OpenDocument
Thanks
uday
0 Kudos
Message 5 of 15
(4,089 Views)

The -2 method is already what I use. I am just asking why I can get an easy method to get all references of my objects to change 'at once' (meaning in a single For loop) all my label font sizes AND NOT the same kind of method to change all my listboxs at once because I need to create the -2 method excplicitely for each of my 50 Listboxes. See attach for the snipet of my VI.

Thanks

 

0 Kudos
Message 6 of 15
(4,087 Views)

If you want get array of links, why you can't collect it and store in shift register or local variable? Or just in wire.

Also you can use Class Id/name property for sorting Controls[] array elements.

class.png

0 Kudos
Message 7 of 15
(4,060 Views)

I understand what you are saying and yes I can get the ClassName and ClassID of each of my controls. BUT the Control Refnum that enters your FOR Loop is generic and when connected to a Property icon it will not make available the corresponding properties of the element to which the Refnum is associated to.

In other words: the Refnum in your FOR Loop will correspond to ListBox, Ring, String,... each one having other properties but the Properties listed will only be the generic one. For instance I do not see the CellFontSize or AutoRowHt in the possible properties...

I do not know how to 'case' the property node properties based on the ClassName or ClassID...

0 Kudos
Message 8 of 15
(4,041 Views)
I checked this can work for your case too : Programmatically Changing Font Size of Front Panel Controls for Different Screen Resolutions http://www.ni.com/example/25988/en/
Thanks
uday
0 Kudos
Message 9 of 15
(4,035 Views)

@Christ0phe wrote:

I understand what you are saying and yes I can get the ClassName and ClassID of each of my controls. BUT the Control Refnum that enters your FOR Loop is generic and when connected to a Property icon it will not make available the corresponding properties of the element to which the Refnum is associated to.

...

Oh, now I understand you.

Use to more specific class

class2.png

0 Kudos
Message 10 of 15
(4,022 Views)