View Issue Details

IDProjectCategoryView StatusLast Update
0008891LazarusLCLpublic2008-04-24 08:08
ReporterIgnace Lamine Assigned ToVincent Snijders  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.22 
Target Version1.0.0Fixed in Version0.9.23 (SVN) 
Summary0008891: TCanvas should not have width and height property
DescriptionTCanvas 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(20,20);
end;

Lazarus thinks width refers to the canvas.
Additional InformationI 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.
TagsNo tags attached.
Fixed in Revision11155
LazTarget1.0
WidgetsetGTK
Attached Files

Activities

Vincent Snijders

2007-05-16 21:07

manager   ~0012675

Explain why it should not have a width and a height property, without refering to Delphi compatibility.

If you use with statements, than you are writing fragile code, so the fact that it breaks your code is not a good argument. That is an extra risk of using with stamements.

Ignace Lamine

2007-05-16 21:18

reporter   ~0012677

Yes, maybe it would be nice if a Delphi canvas had a width and height too.
But these properties should definitely be read-only for a Canvas. Setting the width in the above example generated an exception.

Vincent Snijders

2007-05-16 21:51

manager   ~0012679

It generated an exception because you were writing to those properties.

They are read/write in the base class and the LCL has overriden the (abstract) setter and gives an exception.

Now I added new readonly height and with properties.

Issue History

Date Modified Username Field Change
2007-05-16 20:55 Ignace Lamine New Issue
2007-05-16 20:55 Ignace Lamine Widgetset => GTK
2007-05-16 21:07 Vincent Snijders Note Added: 0012675
2007-05-16 21:07 Vincent Snijders LazTarget => 1.0
2007-05-16 21:07 Vincent Snijders Status new => feedback
2007-05-16 21:18 Ignace Lamine Note Added: 0012677
2007-05-16 21:51 Vincent Snijders Fixed in Revision => 11155
2007-05-16 21:51 Vincent Snijders Status feedback => resolved
2007-05-16 21:51 Vincent Snijders Fixed in Version => 0.9.23 (SVN)
2007-05-16 21:51 Vincent Snijders Resolution open => fixed
2007-05-16 21:51 Vincent Snijders Assigned To => Vincent Snijders
2007-05-16 21:51 Vincent Snijders Note Added: 0012679
2007-09-01 22:22 Marc Weustink Status resolved => closed
2008-04-24 08:08 Vincent Snijders Target Version => 1.0.0