> It turns out my last email wasn't precise enough. I am playing with
> descendents of TDBEdit (TwwDBEdit actually - I'm interested in TEdit as
well
> but it wasn't what I was testing with). It turns out that TDBEdit (and
> TwwDBEdit) have a customised WMPaint procedure which specifically draws
> right justified and centred text!
Oh, well I take no responsibility for controls that paint themselves. ;-)
Seriously though, that will cause you headaches, as a cursory look indicates
that a number of controls do paint themselves and explicitly set the font to
clGrayText if they're disabled. Since you won't want to rewrite them all
you aren't left with many options. You could patch each offending function
using a procedure which searched through each method's source to find the
assignment to clGrayText (it should be distinctive) and replaced the command
with NOPs or a JMP to the next instruction (all not for the faint of heart,
but possible: I patched AddRefArray in System.pas this way. I couldn't just
rewrite it because I was using runtime packages).
Alternatively, and if recompiling the source is an option, you could edit
Graphics.pas and change clGrayText to be black. That'll fix things.
Nothing will ever be grayed again. :-) Actually, this isn't as bad as it
sounds as the only places clGrayText are used seem to be when disabling
things. Oh alright, I admit that you probably don't want disabled menus to
be black... :-)
> I've been playing a bit more and for completeness sake I thought I would
> explain the first problem I listed above. If you create the edit box with
> Enabled = False or you set Enabled to False before the edit box gets
> displayed (and therefore before the window handle is created) then Windows
> will create the window as disabled. Then the code to throw away the
> WM_Enable messages works against you, because no messages ever get through
> to set the window enabled again. Thus the text will always appear in gray.
Then you could just let Enable messages through. That seems to work, ie.
procedure TEditX.WMEnable(var Message: TWMEnable);
begin
if Message.Enabled then inherited;
end;
> The upshot of all this is that making text black on all disabled edit
> controls is a major headache - and I haven't even started to look at
> comboboxes, memos etc.
>
> It's a shame but I've just had a better idea - how about I make the
controls
> ReadOnly and turn TabStop off?
So everyone who suggested that gets a chocolate fish then?
Cheers,
Carl
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"