Forum > Ported from Delphi/Kylix

TCanvas width and height property

(1/2) > >>

Ignace:
TCanvas in Lazarus has width and Height property while TCanvas in Delphi does not. TCanvas should not have width and height property.

When I have following code in a form with a TPaintBox on it, Lazarus crashes while Delphi works:


with Paintbox1.Canvas.Pen do
    with Paintbox1.canvas do
    begin
      width := 2;
      moveto(10,10);
      lineto(40,200);
    end;

Lazarus thinks width refers to the canvas.

I encountered a similar problem in real life when translating a delphi component to lazarus. It gave me weird results where a line was drawn with a linewidth equal to the canvas width instead of the pen width.

Vincent Snijders:
File a delphi bug report for missing properties.

In the mean time, don't use with.

Ignace:
OK, I just found the bug reporting section.
By the way, this is not a missing property, that property SHOULD be missing.

Vincent Snijders:
No, absolutely not. It is a Delphi bug that it hasn't the property. You should report it with CodeGear.

Ignace:
Yeah right :)
Lazarus is the one who is cloning the other, remember :)
I think Lazarus should be consistent with Delphi

Navigation

[0] Message Index

[#] Next page

Go to full version