LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change title bar color in windows style panel

Solved!
Go to solution

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

0 Kudos
Message 1 of 12
(8,153 Views)

Those attributes are valid for child panels only.

 

See the list of panel attributes.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 12
(8,152 Views)

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

0 Kudos
Message 3 of 12
(8,126 Views)

A child panel alone is a contradiction Smiley Wink

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



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?
0 Kudos
Message 4 of 12
(8,123 Views)
Isn't that done at run time? How can this be done and seen in the panel editor?
0 Kudos
Message 5 of 12
(8,120 Views)
Unfortunately it can only be set at runtime. There is no setting in the panel editor.
S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 12
(8,112 Views)

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.



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 7 of 12
(8,103 Views)

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

0 Kudos
Message 8 of 12
(8,087 Views)

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"

Screenshot 2014-06-17 09.56.38.jpg

 

This is how it looks: note the different style for the titlebar:

Screenshot 2014-06-17 09.57.18.jpg

 

I suggest you experiment with the sample project as I have done, and then compare your actual code with that of the example.



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?
0 Kudos
Message 9 of 12
(8,068 Views)

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

0 Kudos
Message 10 of 12
(8,055 Views)