Hello David,
I want to figure out the dimensions of a TWinControl.
Code in Delphi:
function TMainUnitHelper.GetScreenCoordinatesOfWinControl(const Control: TWinControl; var x1,y1,x2,y2 : integer) : Boolean;
var
p : TPoint;
begin
Result := True;
if Control = nil then
Exit(False);
with Control do
begin
p := ClientToScreen(Point(Left, Top));
x1 := p.X;
y1 := p.Y;
p := ClientToScreen(Point(Left+Width, Top+Height));
x2 := p.X;
y2 := p.Y;
end;
end;
In my Delphi-Script in TC I know the Name of the current WinControl,
it is called "NameMapping.Sys.DiaShow.MainForm.Diagram"
The Problem is, that this variable is from type OleObject,
but my Delphi-function needs a TWinControl.
so my test failes trying to use GetScreenCoodinatewsOfWinObject
procedure Test_GetScreenCoordinatesOfWinControl;
var RetCode, x1,y1,x2,y2;
begin
RetCode := NameMapping.Sys.DiaShow.MainForm.TestCompleteHelper.GetScreenCoordinatesOfWinControl(
NameMapping.Sys.DiaShow.MainForm.Diagram, x1,y1,x2,y2);
end;
How can I cast OleObject into TWinControl?
sincerly
Necip Sariali