Am 17.04.2012 22:32, schrieb Reimar Grabowski:
On Tue, 17 Apr 2012 22:19:45 +0200
Sven Barth<[email protected]> wrote:
type
TMyHackImage = class(TImage)
public
function DestRect: TRect;
end;
var
MyImage: TImage;
r: TRect;
begin
// let's suppose that MyImage contains a TImage instance
r := TMyHackImage(MyImage).DestRect
end;
How should that work?
What does the DestRec function look like?
IMHO to access DestRec TMyHackImage must be derived from TCustomImage and in
that case the cast won't work.
Yes, sorry. I've now tested the following example which is different
from your original problem, but it illustrates the hacky mechanism:
=== source begin ===
program hacktest;
{$mode objfpc}
uses
Classes;
type
TMyStrings = class(TStringList)
end;
var
s: TStringList;
begin
s := TStringList.Create;
s.Add('Test');
Writeln(TMyStrings(s).GetCount); // "GetCount" is protected in
"TStringList"
end.
=== source end ===
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus