Hi

Is this FPC behavior correct?
Apparently it works in Delphi, at least ESS Model prog uses it heavily.

The idea is to typecast controls like TForm and TTreeView to a local 
TCrackControl just to reach the protected TControl.OnMouseDown.

  type
    TCrackControl = class(TControl) end;  // <-- empty local class
  var
    found: TControl;
    cc: TCrackControl;

and later:
  // 'found' can be TForm or anything.
  cc:=TCrackControl(found);  // <-- error
  cc.OnMouseDown(...

In Lazarus / FPC it gives 'RunError(219)', or the system becomes unstable.
(I think this created the previous problem instead of interfaces).

The typecast should logically work because the controls inherit from TControl 
and OnMouseDown is defined there.

Juha

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to