UI Interest Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Change UI Style Programmatically ... OR ... "CSS" for LabVIEW

During a previous project I did some LabVIEW code structuring which also included developing a couple of UIs. The opinons about which colors to choose for the different UI components differed drastically between the operators. How could I change the style of all the UIs in one quick and easy way? I came to think about CSS for HTML but for LabVIEW and started scripting... This is what I came up with :

BeforeAfter
TheMessingFeature_default.pngTheMessingFeature_messup.png

Well this is just the first step. Is it possible to exchange the control/indicator types (Modern | Silver | System | Classic) programmatically? Well the replace function (when right-clicking an object on the FP) works so ... now how is this done. I dove in to LabVIEW and found it !

ScriptReplace.PNG

This code replaces all Numeric Controls and Indicators in a VI (which must be in Edit Mode) with the corresponding Numeric Silver Control and Indicator.

To be continued ...

The VI is free for distribution, so go ahead and download BUT please add a comment on what you think about it.

I would like to send a big thxs to my inspiration in this matter; Maria and Bengt ... you know who you are .

______________________________________________

Marcus Törndahl (System Architect)
Comments
AmitKaria2k
Member
Member
on

Messup.vi is a good example.. Good job !

Can you convert the snippet to LabVIEW code and post the example?

crelf
Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast
on

This is a neat concept - nice work!





Copyright © 2004-2023 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
DonRoth
Active Participant
Active Participant
on

Really interesting.  I tested both the snippet and the VI, and they do what you say.  I added some code to test waveform graph replacement and it worked like a champ.

cycleguy
Member
Member
on

I was just thinking about doing something like this, myself.  Did you end up working on this idea more?

MarcusTörndahl
Member
Member
on

Yes I have done some more work on switching controls & indicators style (classic, silver, ...). I haven't worked on this for some time but if your interested I will post some code here asap.

______________________________________________

Marcus Törndahl (System Architect)
cycleguy
Member
Member
on

It would be great if you could share some of your code, I would really appreciate it. Thanks!

DavidZ.
Member
Member
on

Hi Marcus, very interesting to see your examples, thanks a lot for sharing!

I didn't know about the Control Replace method. You explained this works only when having the vis in Edit mode. Is there a way to do the same switching behavior in compiled code when you have your application installed at the customer site?

With my colleagues we were thinking about a good solution to have a color-switchable user interface. And as it's quite a big application with lots of front panel surface and controls, this should be as systematic and smart as possible to reduce effort and be maintainable. We try to use as much recolorable FP elements, but then there are still controls with png icons which need replacement. So far we thought, having 2 sets of controls layed over each other and depending on the UI style make visible one or the other controls set. And have these controls mostly dynamically registered, so depending on the UI style you feed other control references to the subvis that handle the dynamic registration. A user would need to decide at the init which UI style to use.

...well you see not very smooth all that and hopefully there is an easier way. Any ideas?

kaotingguo
Member
Member
on

Excellent work!

Contributors