Lazarus

Programming => Packages and Libraries => Ported from Delphi/Kylix => Topic started by: Ignace on May 16, 2007, 10:27:06 pm

Title: TCanvas width and height property
Post by: Ignace on May 16, 2007, 10:27:06 pm
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.
Title: RE: TCanvas width and height property
Post by: Vincent Snijders on May 16, 2007, 10:49:31 pm
File a delphi bug report for missing properties.

In the mean time, don't use with.
Title: RE: TCanvas width and height property
Post by: Ignace on May 16, 2007, 10:52:37 pm
OK, I just found the bug reporting section.
By the way, this is not a missing property, that property SHOULD be missing.
Title: RE: TCanvas width and height property
Post by: Vincent Snijders on May 16, 2007, 10:55:19 pm
No, absolutely not. It is a Delphi bug that it hasn't the property. You should report it with CodeGear.
Title: RE: TCanvas width and height property
Post by: Ignace on May 16, 2007, 11:00:05 pm
Yeah right :)
Lazarus is the one who is cloning the other, remember :)
I think Lazarus should be consistent with Delphi
Title: RE: TCanvas width and height property
Post by: Vincent Snijders on May 16, 2007, 11:02:53 pm
No, if it can improve for example by adding extra properties, it will.

If you think Lazarus is a clone, that you are in a for a disapointment.

Next you will be complaining about the fact that a form has a text property, which breaks your Delphi code.
Title: Re: TCanvas width and height property
Post by: nanni on December 18, 2021, 05:42:00 pm
with ACanvas do begin
  w:= cliprect.Right -cliprect.Left;
  h:= cliprect.Bottom -cliprect.Top;
  ..
TinyPortal © 2005-2018