[Lazarus] TImage - Getting image properties in 'canvas space'

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Apr 18 09:31:08 CEST 2012


Mattias Gaertner schrieb:
> On Tue, 17 Apr 2012 19:46:08 +0200
> Sven Barth <pascaldragon at googlemail.com> wrote:
> 
>> [...]
>> Well... class helpers are at least an officially supported hackish 
>> approach unlike other forms of making a protected member visible.
> 
> I wonder what protected is still good for when you can use class helpers
> to access protected members from anywhere.

The VCL design often hides properties (as protected), which should be 
accessible by user code, under certain circumstances. The classic 
workaround for such cases was the declaration of a dummy class, derived 
from an existing VCL class, what allows to access the protected members 
of the *base* class in that unit. Such situations now can be handled by 
reusable class helpers, with better encapsulation of the added features; 
they can allow access to *selected* protected members of the class, 
still hiding other protected members.

The downside of the Delphi model: it's hard to determine, which class 
helper is *currently* used in some code, because the unit order in the 
uses clause(s) is involved hereby. That's why I would add my class 
helpers to every unit in which they are used, to eliminate that uncertainty.

DoDi





More information about the Lazarus mailing list