LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

color palette ?

I would like to use the color palette
in progress of my program,
for example to change color of graph
background.

How to do it ?

with greetings
Piotr
0 Kudos
Message 1 of 3
(3,245 Views)
The general way to change element's color in CVI is to use SetCtrlAttribute. For example, to change graph background color you can use
SetCtrlAttribute (panel, control, ATTR_GRAPH_BGCOLOR, VAL_WHITE);
I suggest you to open the function panel for SetCtrlAttribute, click on the 'Control Attribute' field and on the dialog that shows clock on the upper field (Control type) and select the control you have to operate on: that way only the active attributes for that type of control will be shown and it will be easier for you to find the exact one to use.
Once you have seledcted a color attribute, if you press Enter in the next field (Attribute value) you will find some predefined macros for the basic color (like the VAL_WHITE I used before); if you want a different co
lor you can use MakeColor() function, but be careful to the effects particular color has on different color settings of monitor.
For some objects there are different functions for setting colors, for example SetPlotAttribute for graph plottings and SetTraceAttribute for strip chart traces...
Don't bother to ask again if you need more details...
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,245 Views)
Piotr:

In addition to the method that Robert suggested, LabWindows/CVI's Programmer's Toolbox includes a function called "ColorChangePopup()" under Programmer's Toolbox -> User Interface Utilities -> Dialogs. If you right-click on the function panel for this function, there is some example code that you can paste into the interactive execution window to test the ColorChangePopup() dialog. This dialog is very similar to one that LabWindows/CVI uses in it's own environment, which you can see if you choose "Colors..." under the Options menu from the Project window.

Incidentally, this is just one of the little "gems" you can find in the Programmer's Toolbox and the other instrument drivers that ship under the LabWindows/CVI TOOLSLIB directory. There's quite a bit of powe
r in these instrument drivers for doing advanced features that you may otherwise need to use Microsoft's SDK for. For instance, the Programmer's Toolbox provides facilities for putting icons in the system tray and for catching Windows messages.

Good Luck,

Chris Wood
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,245 Views)