Graeme Geldenhuys wrote:
On 5/7/07, Joao Morais <[EMAIL PROTECTED]> wrote:
> An advantage of having it public, is that you can pass a TControl to the
> widget interface and it can access the Color property without resorting
> to cast to decendants. I don't know if this technique is actually used
> though.

There are several properties where this feature would be welcome, eg
tcustomedit.text, tcustomcheckbox.checked, but you can use the following
workaround when necessary:

type
   tcustomeditfriend = class(tcustomedit);

...

tcustomeditfriend(edit).edit := 'value';


I agree...  And if you are going to use it often, create a local
variable of the 'friend' class so you only need to cast once.

Not a good idea if you have inheritance:

twincontrol
  control: twincontrolfriend

tcustomedit
  control: tcustomeditfriend

...

tcustomeditfriend.getcontrol
begin
  result := inherited control as tcustomeditfriend; // problem here
end;

I write many cross compiler (FPC and Delphi) code and keep breaking
the builds under Delphi due to the differences between LCL and VCL.

Yup. This is exactly my headackes. Cross FPC x Delphi and VCL x LCL code. Anyway both fpc and lazarus team are doing an exceptional job regarding compatibility.

--
Joao Morais

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to