LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change VI Style with script

Hi,

I have written a little tool that converts all front panel items to the default style. If I want to change the style of a VI I have to go to the editor options and select the control style before running my tool.

 

I would like to select the new style in my utility, but I cannot find anything looking through the properties or methods for a VI reference. Does anyone know where to find this property?

 

Best regards,

Christian.

0 Kudos
Message 1 of 12
(1,592 Views)

@Pumuckl wrote:

I have written a little tool that converts all front panel items to the default style. If I want to change the style of a VI I have to go to the editor options and select the control style before running my tool.

 

I would like to select the new style in my utility, but I cannot find anything looking through the properties or methods for a VI reference. Does anyone know where to find this property?


It's not a property.

 

Controls of different styles are different controls.

 

I'm afraid you'd have to get all relevant properties, replace the control, then set all properties. Note that not all properties are valid for all control styles (e.g. the color of system controls can't be changed).

 

You might be able to (hold on..) set VI storage to XML or text, get a VI as a binary (e.g. the file), get the front panel heap, (inflate it?,) modify the string, (deflate it?,) reset the password hashes, convert back to a VI... Something similar is done with the splitter style tool that is somewhere on this forum. EDIT: Here: Solved: Re: Access Splitter Bar Style Programmatically - NI Community

0 Kudos
Message 2 of 12
(1,561 Views)

wiebe@CARYA wrote:
I'm afraid you'd have to get all relevant properties, replace the control, then set all properties. Note that not all properties are valid for all control styles (e.g. the color of system controls can't be changed).

It seems that you don't have to get\set the properties.

 

This works pretty well:

wiebeCARYA_0-1646315184522.png

 

You'd have to find a way to get the control type, and link it to the (new) Style enum value.

 

LabVIEW keeps properties, just like a manual replace.

0 Kudos
Message 3 of 12
(1,553 Views)

...I might not have been clear enough on this, i do not have problems with replacing the controls, I want to set the panel default style prior to the replacement.

 

Pumuckl_0-1646315606929.png

 

I found all the other properties for stuff like default fonts, colors, grids etc, but nothing for the style?

0 Kudos
Message 4 of 12
(1,547 Views)

I don't think there's a property for that.

 

It could be a hidden VI tag, or a panel tag. It would take serious digging to find where this setting is stored, and even more to change it.

 

If you start from a new VI, I guess you could store a template for each style.

0 Kudos
Message 5 of 12
(1,537 Views)

isn't most of that stuff in the INI file?

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 6 of 12
(1,524 Views)

@Frozen wrote:

isn't most of that stuff in the INI file?


This is different for each VI.

 

The ini file has an option to set the default for new VIs.

0 Kudos
Message 7 of 12
(1,520 Views)

wiebe@CARYA wrote:

@Frozen wrote:

isn't most of that stuff in the INI file?


This is different for each VI.

 

The ini file has an option to set the default for new VIs.


Oops, should of looked closer before opening my mouth 😴

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 8 of 12
(1,518 Views)

@Frozen wrote:

wiebe@CARYA wrote:

@Frozen wrote:

isn't most of that stuff in the INI file?


This is different for each VI.

 

The ini file has an option to set the default for new VIs.


Oops, should of looked closer before opening my mouth 😴


Don't worry about that.

 

It might be an opening towards a solution.

 

If you set the (global) ini file key, and then script a new VI, would the new VI have the new style?

 

get the key

change the key

create a new vi

reset the key

 

Not ideal, but if it works it's something.

0 Kudos
Message 9 of 12
(1,479 Views)

Maybe something like this would help you.

ini.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 10 of 12
(1,461 Views)