Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-09

TControlSizing.Size is not symmetric!?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

Reading the TControlSizing.Size property does not return the written value, instead it increases it by Around.

This will cause

   cs.Size[side] := cs.Size[side];

to increment the stored size by Around, for every invocation!

Is this really intended behaviour???

While GetSpace and SetSpace have equivalent names, GetSpace adds Around. GetSideSpace (called by GetSpace) returns the stored values instead.

For symmetric behaviour
     property Space[Kind: TAnchorKind]: integer read GetSpace write
SetSpace;
should be replaced by
     property Space[Kind: TAnchorKind]: integer read GetSideSpace write
SetSpace;

Also:

     procedure Change(InnerSpaceChanged: Boolean); virtual;

ignores the argument. The method is virtual, of course, but where is it ever overridden?

DoDi

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich
Show quoted text 8 lines
Reading the TControlSizing.Size property does not return the written value, instead it increases it by Around. This will cause cs.Size[side] := cs.Size[side]; to increment the stored size by Around, for every invocation! Is this really intended behaviour???

Good grief. No.

While GetSpace and SetSpace have equivalent names, GetSpace adds Around. GetSideSpace (called by GetSpace) returns the stored values instead.

GetSpace should be the counterpart of SetSpace.
Gladfully it was never documented, so probably no one used them except the LCL. I swapped them and will add it to the release notes. Currently the wiki server is very slow.

Thanks for pointing this out.

Show quoted text 5 lines
Also: procedure Change(InnerSpaceChanged: Boolean); virtual; ignores the argument. The method is virtual, of course, but where is it ever overridden?

Since the new autosize algorithm the parameter is no longer used by the LCL.
As far as I know no one uses it at the moment. Of course this might change, when we add the mechanism to implement your own layout engine.

Mattias

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner
GetSpace should be the counterpart of SetSpace. Gladfully it was never documented, so probably no one used them except the LCL. I swapped them and will add it to the release notes.

I'll check and update the docs accordingly.

Show quoted text 6 lines
> procedure Change(InnerSpaceChanged: Boolean); virtual; > ignores the argument. The method is virtual, of course, but where is it > ever overridden? Since the new autosize algorithm the parameter is no longer used by the LCL.

Okay, I'll document it accordingly.

DoDi

Reply by email