View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0008891||Lazarus||LCL||public||2007-05-16 20:55||2008-04-24 08:08|
|Reporter||Ignace Lamine||Assigned To||Vincent Snijders|
|Target Version||1.0.0||Fixed in Version||0.9.23 (SVN)|
|Summary||0008891: TCanvas should not have width and height property|
|Description||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
width := 2;
Lazarus thinks width refers to the canvas.
|Additional Information||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.|
|Tags||No tags attached.|
|Fixed in Revision||11155|
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.
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.
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.
|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|