PDA

View Full Version : How can I fix this?



Harry Hunt
01-05-2003, 08:42 PM
Hi again :)
I'm writing a Delphi VCL component (decendant of TCustomControl) that loads and displays X-Files and MD2-Files and i have a small problem.
It works fine, if i drop it directly on the form. So for example if the Left and Top coords of my TMeshViewer component are 100 and 200, the scene will be drawn at X: 100 and Y: 200.
However, If i put my component into, let's say a TPanel, the scene is drawn at X: 0 and Y: 0.
I'm sure there is a way to fix that, but how?

Thanks in advance
Harry Hunt

LP
02-05-2003, 01:20 AM
Greetz... since TPanel becomes owner of your component, the coordinates it have are relative to TPanel. One possible solution would be looping through Object owners and re-calculating the object position. For instance, RenderY:= Top + Owner.Top.

Hope this helps,
Lifepower

Alimonster
05-05-2003, 10:52 AM
Would the Parent property of TControl not be more suitable than the Owner?

Harry Hunt
05-05-2003, 11:26 AM
Thanks for your help. I found a different way to fix it which works fine.