[lazarus] Size issues in win32
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Aug 21 10:19:20 EDT 2003
On Wed, 20 Aug 2003 21:10:32 -0300
Karl Brandt <pascalive at bol.com.br> wrote:
> Here's a patch that calculates menu height and fix GetWindowSize for
> TCustomForm.
Thanks. Applied.
> Also fix GetRelativePos when parent is TGroupBox.
>
> I must warn that this patch doesn't fixes the problems introduced after
> the recent changes and that were reported by Micha.
He reports that some of the complex forms of the IDE do not look good. This
can have many reasons. Can you send us a small example, where the groupboxes
are too small?
> Mattias, please take a closer look at LM_SETSIZE. The previous
> implementation does the same as the current with a cleaner/faster
> approach:
>
> if we assume that
> NewRect.Right:=NewRect.Left+(R.Right-R.Left);
> Then
> NewRect.Right - NewRect.Left =
> NewRect.Left+(R.Right-R.Left) - NewRect.Left =
> R.Right-R.Left -> the previous value
Of course it is mathematically the same. And there was no bug in the former
code.
The former code did the following:
It used part of the rectangle of the LM_SETSIZE message and the noname var R
for the size. And in the end it used the position of the message rect and
the size of R for the resulting rect. No problem.
And it used a "with" for the message rect to get rid of the ugly
PRect(Data)^.
As I debugged and added code, I changed it to use only one rect (NewRect)
for the bounds and use the nameless R only as a temporary rect. As I deleted
the debugging code, this was left. A "with" would of course clean up a bit.
The speed decrease is not measurable, so it is simply a matter of taste. We
can return to the former code (copy&paste). But I suggest to rename R to
SizeRect to make it more readable.
Mattias
More information about the Lazarus
mailing list