Highlighted
Absent Member.
Absent Member.
1151 views

[archive] Disabled Control Color

[Migrated content. Thread originally posted on 03 August 2004]

I have controls and entry fields that are disabled, but they show
as light grey on the screen and it is difficult to read , is it possible
to change the color of disabled controls
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

We have done this by just modifying the control's "COLOR" property. Perhaps there are other ways to do this, but this is how we accomplished it and it's worked fine.

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

I see that works, but I dont want to change 500 + programs
I see there is a config file entry DISABLED_CONTROL_COLOR but this only affects console programs and not windows programs, any other ideas how to do a global change without updating all the sources
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

This probably doesn't help either, but another thing that you can do is make the control read-only instead of disabled. Then the foreground stays black with a grayed background. The downside is that you can still click in the control and it will keep the focus.

Robstan, what COLOR value do you use? I tried playing with a few and couldn't come up with one that did what I want (black text on grayed background - basically what the read-only property does, but allow the field to be disabled also). I thought COLOR 1 would have done it, but it changes the background to white and leaves the foreground gray.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

Joe,

We allow our users to choose the font using W$FONT. We save that output and then use it for our modify of the control.

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

Originally posted by JoeD
This probably doesn't help either, but another thing that you can do is make the control read-only instead of disabled. Then the foreground stays black with a grayed background. The downside is that you can still click in the control and it will keep the focus.


We do this aswell, but on top of what JoeD says above, we also set the NOTAB property to TRUE.


Shaun
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

I have researched this one extensively and concluded that it is (almost) impossible, including sending custom messages to the control. The problem is AcuCorp has not implemented WM_CTLCOLOREDIT message handler, which could be considered a bug or a missing feature, depending on how you look at it.

The problem is that the entry-field edit controls are subclassed and the subclassing routines set the color to a hard coded value at render time.

Re-sublcassing theoretically possible. I got frustrated and gave up, though.

no-tab + readonly is the closest thing, but the kicker is there is no way to query this in code (you can't inquire styles). Therefor, it you can't really keep before/after procedures from executing (thanks to the mouse) by checking the read-only state..

The only other option is to use an activex text control, but IMO there is no way to make them data-bound. So it's lose-lose.

AcuCorp, please fix..this is very annoying!

Merlin
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Disabled Control Color

We do process WM_CTLCOLOREDIT....

If we did not, I am sure we would have gotten many funny effects. There might be a special case that slips through though.

If, as it may seem, there is a chance the runtime doesn't behave as expected I suggest you forward it to Tech support for evaluation of whether it is a bug or if it may be a sound enhancement request.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.