LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Possiblity to select menu, Font settings programmatically of a vi in edit mode?

Hi all, 

 

Is it possible to select menu, font settings of a vi in edit mode programmatically using vi refs? 

 

Motivation:

 

I need to make all controls to times new roman Font type programmatically, One option is to get refs and do for every single controls.

Second, we already have option to select font settings manually after selecting control in vi. so i am trying to use that option programmatically.

 

0 Kudos
Message 1 of 10
(3,834 Views)

Sure here is a quick VI that uses VI Server to change the font size of all controls and indicators, you can change it to support what you want.  Scripting is amazing.

 

 

Example_VI.png

0 Kudos
Message 2 of 10
(3,797 Views)

 

Hooovahh, 

 

Thank you for reply,

 

 

Problem with mentioned method:

 

  • Whole controls has to be changed not only label and caption even value content, and ofcourse it is possible by scripting but many different class of controls are possible and each class should have different case.
  • Container controls will be difficult as it can contain cluster inside cluster inside cluster, and it is again possible to get all controls reference recursively, worried on complexity.

What i am looking for is,

A normal vi in edit mode, we can select controls and just select Font settings as arial and everything is done (Caption, label, content). so i am trying to do accomplish that programmatically. I guess, some dll function to call to select font settings.

0 Kudos
Message 3 of 10
(3,767 Views)

Manijas wrote: 

 

  • Container controls will be difficult as it can contain cluster inside cluster inside cluster, and it is again possible to get all controls reference recursively, worried on complexity.

The Traverse for GObjects already does this.  The VI I posted goes into clusters, arrays, and tab containers.

 

That being said I agree this only changes labels and captions.  I would be possible to write more scripting code which for each control class type you have, use to more specific and then set those properties as well.

 

There is also possibly another option that I don't have experience with, but you can basically change your LabVIEW.ini (or the INI for your built application) and it will change what "Application Font" is, or "Dialog Font".  So if your whole UI uses the standard Dialog Font you can probably change all of them at once using the INI. Unfortunately having never done this I don't know the steps or limitations.

0 Kudos
Message 4 of 10
(3,747 Views)

You can also set the Fonts by using the Tools/Options/Environment settngs, which lets you specify what you want for each of the Font categories.  Like Hooovahh, I've never tried changing this, but I presume it will work (otherwise why would NI provide it for us?).

 

Bob Schor

0 Kudos
Message 5 of 10
(3,737 Views)

Thanks Hooovahh and Bob for reply,

 

Changing INI file will help once you restart labview, but i need to change font settings and save vi and different font settings are also possible.

0 Kudos
Message 6 of 10
(3,705 Views)

And one more thing, i am attaching a vi which uses a some built in functions to get a font type selected and some other function TSETFONT for which arguments to be passed is unknown.

 

Is there any way to find arguments for function? For dll we can find using dll explorer or labview inbuilt import shared library. But this is of different function, couldn't guess it is dll or not.

0 Kudos
Message 7 of 10
(3,702 Views)

TSetFont is a LabVIEW manager function and as such equavalent to a DLL call (executables are also just COFF files and can export functions exactly the same as DLLs). However all the functions not documented in the External Code Reference Manual section of the online help are considered LabVIEW private. NI never documented them for various reasons such as:

 

- Being brittle if not called with the correct parameters

- Functionality is incomplete

- NI wants to reserve the right to change the functionality in future versions, once documented a change is virtually impossible!

- Necessary to be exported so LabVIEW can call them from the generated compiled code in a VI but pretty useless from outside the LabVIEW internal context

- Proof of concepts that never have been finished but remained in the codebase because part of it is used elsewhere in the code

 

The Font APIs (functions starting with an uppercase T) exist since the early days of inception of LabVIEW multiplatform version but are pretty useless from within a LabVIEW diagram. They either work on some specific object whose object pointer you can't get from inside the diagram or are more or less disfunct since LabVIEW changed a lot in all those years. But being an exported API NI doesn't lightly remove it from the exported function table although many of them are in newer LabVIEW versions not much more than some stubs returning an error code or not doing anything at all.

 

In absence of a proper documentation there is no way to get at a reliable argument description from an exported function other than:

 

1) get it from the source, a LabVIEW developer

2) disassembling the code to try to guess the functionality but that is not only pretty difficult but in many places on earth highly illegal too. (not to mention that it is not really reliable).

 

The editor_pref_SelectFontStyle() function from the name looks like a recent addition in newer LabVIEW versions. I would expect its chance to be a stable API very very small. Looks like an API added for a specific tool in LabVIEW that will change at a whim of the developer of this tool without any warnings and crashing any VI using it when upgraded to that new LabVIEW version. Using it in your own code is a sure way to build in a time bomb that can go of at any time when you change the LabVIEW version.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 10
(3,683 Views)

Thank you so much rolfk, for detailed reply.

 

It seems some NI folks should answer thisSmiley Indifferent

 

But other away i am trying is to programmataically press CTRL + 0 for font dialog using user32.dll and again it is long task to select font.

0 Kudos
Message 9 of 10
(3,623 Views)

Hi all,

 

Vi to set fomt settings using user32.dll not a direct way of accessing font settings functions.

 

Thanks.

0 Kudos
Message 10 of 10
(3,587 Views)