David Smith wrote:
> I'm confused by this discussion. I am looking at a
> TEdit and it's got Enabled, color, and Font.color all
> right there on the object inspector. It's also got the
> readonly property available.

I'm confused, too. This problem has absolutely nothing to do with the
Font, Color, or Enabled properties. Nothing you do to those properties
will change the way the TEdit control paints itself when it's disabled.

The TEdit gets painted by code in a Windows DLL. It honors the user's
preferences regarding what color to use for disabled text and window
background.

The goal here is to have a TEdit control that, when disabled, paints
itself with a background of some color, presumably the default clWindow
(not clWhite), and with a text color of clRed instead of the default
clGrayText (not clGray). To do that, you need to write your own painting
code. I think that involves writing your own wm_Paint handler since edit
controls don't support the notion of owner-draw.

If you're going to use a non-default foreground color, make sure to also
use a non-default background color. Otherwise, you risk painting
unreadable text. I wonder why the text needs to be red in the first place.
What's wrong with the user's preferred color for disabled windows?

-- 
Rob


Reply via email to