[Lazarus] Why is TCustomControl.Canvas public?

Luiz Americo Pereira Camara luizmed at oi.com.br
Thu Jul 14 01:37:28 CEST 2011


On 13/7/2011 05:42, Flávio Etrusco wrote:
> Hello,
> Wouldn't it better to make Canvas protected and pass it on the OnPaint event?

Yes. It seems a Delphi compatible design

> I'm almost sure is was also public in Delphi,

Yes it is.

>   and I don't even
> remember Delphi having OnPaint in TCustomControl,
Yes Delphi does not has.

IMHO it does not makes sense since TCustomControl is not supposed to be 
used directly. It's supposed to be derived and override Paint. The same 
for SetColor. Color should not be public so not handled by default in 
TCustomControl.

> but...
> BTW why is OnPaint called inside TCustomControl.Paint instead of
> TCustomControl.PaintWindow?

PaintWindow -> Paint -> OnPaint

Luiz




More information about the Lazarus mailing list