06-15-2014 01:16 PM
Hi,
I'm developing an application that has a panel with black background and green or red numbers. I've added numeric controls and configured the text color and text background color attributes accordinglingy. I set the numeric control to hot or validate control mode and show the inc/dec arrows, since I want to be able to incr/decr the numbers.
The problem is that when I run the application and I hit the inc/dec arrows, then the colors inside the numeric control frame become inverted: the black background becomes white and the green number becomes cyan. I've created a callback function assosicated with the numeric control and tried forcing the text and background color, in the EVENT_VAL_CHANGED section, using the SetCtrlAttrribute() function, but to no avail. Also added ProcessDrawEvents didn't help.
When I mouse click again outside the numeric control, then it reverts back to its original colors (green text, black background).
Any suggestions as to how I can fix this ?
I want it to keep its original colors at all times, even when I'm clicking the incr/decr arrows...
Kind regards,
pgriep
Solved! Go to Solution.
06-15-2014 04:37 PM
Can you post a small sample that reproduces this behaviour?
06-16-2014 01:54 AM
Hi Roberto,
I think you may want to check the UIR file, therefore I've attached the CVI code as a zip file for you to try..
I'm running Windows 7 Pro 64-bit and my screen is set to 1920x1080, 32-bit color.
Cheers,
pgriep
06-16-2014 02:47 AM
Ok, now I see what's happening.
The effect you are seeing is a resul of standard numeric control behaviour combined with the black bcakground: when you use arrows to increment/decrement a numeric control its value will be automatically highlighted; on the default background you'll see the white area and figures highlighted in black (white numbers on balck background). If you set the background to black the system will automatically change the colors used to highlight the text, and that's what you're seeing.
By the way, this does not happens if you use up and down keys on the keyboard: text is not highlighted so colors are not changing.
Additionally, this is not only valid for numerics: see the behaviour of the string controls on the bottom of your panel when you tab up to them. This effect does not happen on controls set as indicator like the big clock in the upper part of the panel.
The only way I can see to overcome this behaviour is to hide control built-in arrows and create your own up and down buttons with which you can manipulate the numeric control. I am attaching a modified version of your project with buttons on the left numeric; sorry for the poor aesthetic: I have used some arrow icons I had on my disk, you may want to create your own arrows with the colors and shape you prefer.
06-16-2014 03:04 AM
Hi Roberto,
I figured this would be an alternative way to fix it. Just hoped I could fix it by setting or clearing an attribute.
Thanks for the effort!
Cheers,
pgriep