LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

inconsistent control appearance

Solved!
Go to solution

Hi,

 

using the UI editor I came across the following somewhat inconsistent visual appearance of various control elements such as numeric controls and ring controls, see the figures below.

 

Scenario I: In the UI editor, the two controls are set to INDICATOR. Running the program yields appearance I. Setting the control mode to NORMAL programmatically, changes the look to appearance II. So far it's ok with me Smiley Wink.

 

Scenario II: In the UI editor, the two controls are set to NORMAL. Already in the editor, they look different from appearance II. Running the program, they still look different, see appearance_III.

 

Having various controls on a panel hence may yield a hotchpotch of designs Smiley Surprised What I would expect is that controls look the same in NORMAL mode whether this mode was set in the editor or during program execution.

 

Just for your interest, the upper control is a ring, the lower a numeric.

 

I:       appearance_I.jpg

 

II:        appearance_II.jpg 

 

III:      appearance_III.jpg

0 Kudos
Message 1 of 8
(4,345 Views)

Wolfgang:

 

I have never really liked the different default background colors for indicators vs. a hot control, but you can easily change the background color of a control using the UI editor.  In the UI editor, double-click on the control to edit it, then, in the Quick edit window, select the paintbrush tool, then right-click on the control background, and select any color you want.

 

For some controls, you can programmatically set the background color using SetCtrlAttribute() to set ATTR_TEXT_BGCOLOR.

0 Kudos
Message 2 of 8
(4,311 Views)

Thanks, Al!

 

What I am complaining about is not the different look in principle but the fact that the look (i.e. the default background color) depends on the control history...

 

Although in both cases (II and III) the control mode is NORMAL (or HOT), the controls look different, the only difference is that once the mode has been set programmatically, in the other case in the UI editor.

 

Your are correct, it is possible to change color both programmatically and in the UI editor, but actually I think that these different appearances are a little design bug and should be fixed it in a future release. In particular as the attributes 'conform to system colors' and 'Use Windows Visual styles' don't affect this difference...

 

Wolfgang

0 Kudos
Message 3 of 8
(4,306 Views)

Yeah, I hesitated replying because I thought you were probably making a point to NI about a long term fix and already knew the short term fixes.

 

I agree that the default behavior is inconsistant and doesn't make much sense.

0 Kudos
Message 4 of 8
(4,303 Views)

I have seen similar issues with Tab controls and having tabs become randomly different colors on an installed computer. Some tabs are the dark indicator color while others are the default, yet they are set to hot or active.

0 Kudos
Message 5 of 8
(4,296 Views)
Solution
Accepted by topic author Wolfgang

There actually are well-defined rules that explain what you're seeing, although I concede that they can be a bit obscure. Unfortunately, all alternative rules so far have proven to be worse, and so this is probably the least bad scenario.

 

I'll explain:

 

1. The background of those controls changes when you toggle the control mode between indicator and non--indicator if, and only if, you have the conform to system colors option enabled for the panel (in the ui editor, it will also change if you have the "use system colors as defaults for panels and controls" option enabled, in Options>>Preferences).

 

2. By default, any new panel that you create in the UI Editor doesn't have its conform to system colors option enabled (unless you change this in the Options>>Preferences dialog). The reason for this default is that if panels had that option enabled by default, any time you'd try to paint any control in that panel, you'd be pestered with a dialog saying that you couldn't paint unless you disabled that option. That dialog was considered annoying, and so we wanted to reduce its frequency. The reason we need to display that dialog when the option is enabled is because, otherwise, you would be able to change a whole bunch of colors, everything would look fine, and then you'd save the .UIR and reload it, and all your colors would be lost as the panel would revert to its system colors (this option is enforced at panel load time, or whenever a new control is added to the panel)

 

3. Because panels are not set to system colors by default, when you're running your program, those panels have the ATTR_CONFORM_TO_SYSTEM_COLORS attribute disabled. That means that when you toggle the control mode of your numerics programmatically, the background color will not change (see rule 1) and the controls end up looking like your screenshot II instead of the more common screenshot III.

 

You could eliminate this oddity by enabling the Conform to System Color option, either on an individual panel, or globally in the Option>>Preferences dialog.

 

Luis

0 Kudos
Message 6 of 8
(4,286 Views)

Edited item 3 in the previous post to read "when you toggle the control mode of your numerics programmatically" instead of "when you toggle the control mode of your numerics in the UI Editor".

 

Luis

0 Kudos
Message 7 of 8
(4,279 Views)

Hi Luis,

 

thanks for the explanation! But I am afraid that I will soon forget about these subtle combinations Smiley Wink

0 Kudos
Message 8 of 8
(4,270 Views)