06-14-2014 05:11 PM
I have a panel, in a windows style, and I want to change the default color (blue) to something else.
I see the 'Title Background Color' and the 'Title Color' are grayed out in properties under 'Title and Titlebar Appearance'.
Is there anyway I can change that blue to some other color?
Thanks
Solved! Go to Solution.
06-14-2014 05:18 PM
Those attributes are valid for child panels only.
See the list of panel attributes.
06-15-2014 03:12 PM
So how does one go about making a 'panel' a child of another panel, or a child panel alone?
It seems all the panels I create have the attributes greyed out that I need.
Thanks
06-15-2014 04:50 PM
A child panel alone is a contradiction
You define a panel as a child one by passing the handle of an existing panel to LoadPanel
See an example in your CVI samples folder called panels.prj
06-15-2014 06:34 PM
06-16-2014 12:47 AM
06-16-2014 02:52 AM
To be a bit more precise, the aspect of the panel (titlebar and frame style) you see in the editor is the one it will have if loaded as a child. When loaded as a top-level panel it will follow the Windows theme active in your system.
06-16-2014 12:19 PM
OK so I tried setting the title bar color on a child panel and am getting a error of "Library function error (return vaule == -46[0xffffffd2]). The attribute passed is not valid".
I'm using the following code:
int bChildPanel = NULL;
int nStatus = 0;
// load panel
bChildPanel = LoadPanel (bMainPanel, "test.uir", MYCHILD_PANEL);
nStatus = SetCtrlAttribute(bChildPanel, MYCHILD_PANEL, ATTR_TITLE_BACKCOLOR, VAL_DK_GRAY);
Any suggestions?
Thanks
06-17-2014 03:09 AM - edited 06-17-2014 03:15 AM
Just tried with panels.prj example in CVI2012.
I never receive the error you are getting; nevertheless, the titlebar color attribute is honoured only if the title bar style is set to "Classic"
This is how it looks: note the different style for the titlebar:
I suggest you experiment with the sample project as I have done, and then compare your actual code with that of the example.
06-17-2014 09:23 AM
As per your suggestion I loaded the panels.prj into my Labwindows 2010 enviroment added the 'SetCtrlAttribute' and now am getting the following error:
"NON-FATAL RUN-TIME ERROR: "panels.c", line 45, col 5, thread id 0x00001DF8: Library function error (return value == -13 [0xfffffff3]). Invalid control ID"
I only added one line, see snippet below:
hparent = LoadPanel (0, "panels.uir", PARENT);
g_hchild1 = LoadPanel (hparent, "panels.uir", CHILD1);
g_hgrandchild1 = LoadPanel (g_hchild1, "panels.uir", GRNDCHILD1);
g_hchild2 = LoadPanel (hparent, "panels.uir", CHILD2);
g_hgrandchild2 = LoadPanel (g_hchild2, "panels.uir", GRNDCHILD2);
SetCtrlAttribute(g_hchild1, CHILD1, ATTR_TITLE_BACKCOLOR, VAL_DK_GRAY);
Any clues as to why I'm getting the above mentioned error from the 'SetCtrlAttribute' call"
Thanks