LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Color manager for Labview?

I'm beginning to start a color manager for user interface vi's. Basically I'd get a listing of controls, sort them by class, and try to set the color of backgrounds, text, etc programmatically. I'd like for the user to specify backgrounds, text, decoration (raised box), and other colors, and have them set automatically to all user interface vi's in memory.

Has anyone attempted this before? It seems to be fairly feasible, but looks to be a lot of work to implement.
0 Kudos
Message 1 of 5
(3,329 Views)
Jay,

I'm developing the "SEMA-100 Machinery Analyser", a product of SEMA-TEC AB of Sweden. The color of the user interface of this system may be set by the user.

I don't know if this is exactly what You are looking for but I'll give You a short description anyway, might give You some ideas.

First of all forget the decorations, they have no properties and their color can therefore not be set programatically, but there are a number of alternative methods to create decorations. Myself I always use text indicators to create "sub-panels" or "frames" on the front panel of a vi (this will produce lowered boxes instead of raised ones). Just use a property node to set the text background color to the desired color of the text indicator. Don't forget to right-click these text indicators and select "disabled" under the advanced meny, if You don't, the indicator will hide any controls on it, if it is clicked with the mouse by the user.
The most straight forward method would of course be to use color box indicators, however a error in labview 6.1 and previous, makes these indicators to scale inproperly if You use them on front panels which are set to automatically scale with screen resolution.

Otherwise the SEMA-100 application produce user selectable colors as follows:

1. A "setup" vi is used by the user to select the desired colors for different types of controls and indicators. This is just a list of control types together with a color box control for each type, the selected colors are saved in a global variable (and also in a file so that the system can remember the setting from one time to another).

2. Each vi that has a front panel that is displayed on screen uses a sequence where the first frame always sets the user interface. Basically all reconfigurable front panel objects has a property node in this frame where the previously mentioned global variable is read and the properties are set accordingly.

This way of doing it is fairly straight forward, but as You mentioned it of course needs some work, especially if You have a great number of complicated panel. However, once introduced it's no big deal implementing it for new vi's.

I developed this method quite some time ago, and still hangs on to it since it works ok, maybe there are better ways to accomplish this? would be interesting to get more ideas from other programmers!

Since where talking front panels, please note that the tab control does not scale properly on front panels which are set to scale with screen resolution.

tomcat
0 Kudos
Message 2 of 5
(3,329 Views)
>"but looks to be a lot of work to implement"

You got that right!

You may want to investigate some Jeanne-Piere's work. He seems to have a good conceptualzation of classes etc. I think he has some code that can handle any data type. There is probably some things worth looking at if you do decide to do this project. I have done similar work for simlar tasks but my data types where limited to "no-clusters" and "no-arrays". I think this let me just get away with looking at the type specifier of the controls I found. This let me take a lot of short cuts that probably will not be usefull in what you trying to do.

Tomcat had some good ideas.

Let us know how this shakes out.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(3,329 Views)
Getting references to decorations has bit me more than a few times. LabVIEW 6.1 does have the ability to generate the references although it is not obvious how one does this. I have attached an example program to demonstrate.

Warnings: The references are returned as an array so the programmer must find through experimentation the index to the decoration of interest. Once this index found, deleting a decoration placed before the one of interest will mess up the indexing. To reduce headaches, get your front panel the way you want then determine the indices.
0 Kudos
Message 4 of 5
(3,329 Views)
I'm posting what I've accomplished so far. I've run into a few dead ends though:

1. There doesn't seem to be a property for the color of a menu ring that I can change.

2. I can't change the background color of a tab control. I was thinking about stretching a decoration over each page of it so that I'd be able to change the background color. This probably wouldn't work with the selector tabs though, and might not look right near the borders.

3. Quite a few controls haven't been implemented yet. (Listboxes, graphs, etc.)

The zip file I've attached has the Color Control Class, along with a test vi to run it with. Extract the two files to the same directory and open up test.vi. (For those unfamilar with classes, don't double click the class,
use file->open to get to individual sub-vi's, because there are a lot of top level vi's that'll pop up on you)

Right now, I've sorted decorations by vi to primary and secondary. The primary is the farthest towards the back (layers), and the secondary are all the rest. I might eventually allow different groups (primary, secondary, and tertiary) sorted by both layer, size, and position by checking for overlap, and z-order. This would allow for more complex panels.

Also, I have a control called hover boolean. The manager doesn't map it to anything right now. In the application I am developing, it is the color that booleans are highlighted when a mouse passes over them. (A neat trick accomplished by transparent picture controls.)

If anyone can help fill in some of the gaps, I'd appreciate it.
0 Kudos
Message 5 of 5
(3,329 Views)