On 13/7/2011 21:03, Flávio Etrusco wrote:
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.
I kind of agree; that must be the reasoning for Borland.
OTOH I realize it can be quite useful for quick hacks,
TCustomControl is to be a base class not for quick hacks. Adding more
functions would blow the code for most components that don't use it
OnPaint can be even undesired in some controls
If some descendants needs OnPaint is pretty simple to add with the
benefit of choosing where to call.
As an example see
http://code.google.com/p/luipack/source/browse/trunk/cairo/lcl/cairolcl.pas#86
OnPaint and SetColor are not necessary here just blow code
like painting a
background image. It'd be even more useful there pre- and post- events
hardcoded in PaintWindow. I vote for Painting and Paint, respectively
;-)
I would keep a lean base class. Even i would remove onpaint and setcolor
altogether
Anyway, since TCustomControl is not a visual control and you need those
features, you can create easily an descendant and use it as base for
your components
Luiz
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus