> Thanks Carl - the chocolate fish is being couriered to you as we speak.
Excellent. Mission accomplished.
> Couple of comments however.
> 1. Throwing away the WM_Enable messages works well but you need to let at
> least one WM_Enable True message through (so that it thinks it is
enabled).
> No problem there.
> 2. Even so it only works if the edit box has Left Justified text. Yep, you
> heard me right, if the text is centred or right justified then a different
> drawing routine is obviously being used and the text still comes out dark
> grey.
Er, neither of those comments make sense, and when I try it here it works
for me anyway. :-) Here, you have a go:
// Interface
type
TEditX = class(TEdit)
protected
procedure WMEnable(var message: TMessage); message WM_Enable;
public
procedure CreateParams(var Params: TCreateParams); override;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FEdit: TEditX;
end;
// Implementation
procedure TEditX.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or ES_Right;
end;
procedure TEditX.WMEnable(var message: TMessage);
begin
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FEdit := TEditX.Create(Self);
FEdit.Parent := Self;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FEdit.Enabled := not FEdit.Enabled;
end;
Just run it, enter some text, click the button, try to enter more text (you
can't), click the button again, try to enter text again (you can). The
colours of the edit will not change.
> Nice try though... I might let you keep the chocolate fish ;-)
Oi - I thought you said it was already on its way!
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"