[DUG] Component creation
Gary T. Benner
gary at 123.co.nz
Tue Sep 5 11:03:59 NZST 2006
[Reply]
Hi Rob,
What is your component hierarchy?
I presume that as it is clickable it descends from TWinControl, so you can trasp the enter and exit messages. (hopefully)
See below some demo code I wrote to show a descendent of TEdit changing background color on entry and exit.
cheers
Gary
unit Edit1;
interface
uses
SysUtils, Classes, Controls, StdCtrls, Graphics;
type
TEdit1 = class(TEdit)
private
{ Private declarations }
procedure MyExit(var Message: TCMExit); message CM_EXIT;
procedure MyEnter(var Message: TCMEnter); message CM_ENTER;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('GCS', [TEdit1]);
end;
{ TEdit1 }
procedure TEdit1.MyEnter(var Message: TCMEnter);
begin
color:=clYellow;
end;
procedure TEdit1.MyExit(var Message: TCMExit);
begin
//
color:=clWindow;
end;
end.
At 10:17 on 5/09/2006 you wrote
>To : delphi at ns3.123.co.nz
>CC : >From: Robert martin, rob at wildsoft.co.nz
>Content Type: text/plain
>Attached: >
>Hi
>
>I have a custom component that expands to show data. When focus changes >it reverts back to its shrunken state. However I also want it to revert >to small if the user clicks the mouse anywhere outside of the component >(the way that TComboBox does if it is dropped down).
>
>I assume I need to trap a windows message to handle this but I just cant >see which.
>
>Any suggestions ?
>
>-- >Rob Martin
>Software Engineer
>
>phone +64 03 377 0495
>fax +64 03 377 0496
>web www.chreos.com
>
>Wild Software Ltd
>
>_______________________________________________
>Delphi mailing list
>Delphi at ns3.123.co.nz
>http://ns3.123.co.nz/mailman/listinfo/delphi
>
Ref#: 41006
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20060905/8f0f8ba7/attachment-0001.html
More information about the Delphi
mailing list