[Lazarus] Fwd: Re: Exception in OnResize event handler

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Nov 7 16:45:06 CET 2016


I did a reply but then saw that this email was
not sent via Lazarus mailing list
but directly from zeljko to me.
I therefore forward it again to the list.


-------- Weitergeleitete Nachricht --------
Betreff: 	Re: [Lazarus] Exception in OnResize event handler
Datum: 	Mon, 7 Nov 2016 16:07:24 +0100
Von: 	Jürgen Hestermann <juergen.hestermann at gmx.de>
An: 	zeljko <zeljko at holobit.net>



Am 2016-11-07 um 09:10 schrieb zeljko:
>> Then I don't know what the text is about at all.
>> It warns but does not say against what.

> It's against thinking that OnResize triggers only when width or/and height is changed.

But that's the first sentence:

"This event is triggered after the Width, Height, ClientWidth or ClientHeight
of the control has changed,..."

So it's already all said in the first paragraph.
Why repeat the same in convoluted and wrong wording?
Reading the same in other words lets me think that
there is something else to discover which I do just not get now.
This text

"Common mistake: Keep in mind that ClientWidth and ClientHeight can change even when Width, Height stays the same.
For example when the theme changes, the Width and Height remain the same,
but the changed frame reduces the ClientWidth and ClientHeight.
This does not happen that often under Windows, but it happens quite often on other platforms.
Especially it is not sufficient to write only a TForm.OnResize handler to resize all controls on the form. This is a common bug in Delphi applications. "

should be reworded more clearly.
It starts with "Common mistake:" but then does
not tell about this mistake but only explains what has
been said above already. So what is done wrongly often?

And telling me that size changes of components within the Form are
not triggered by OnResize of the Form is somewhat confusing (because it's a banality).
Therefore I was under the impression that I had to do additional
things because I only used OnResize of my Form.
Especially, because the last sentence is wrong.
Of course can it be sufficient to resize all controls on a form
within a TForm.OnResize handler only.
I can simply reduce (or expand) sizes of the components
in relation to the ClientHeight/-Width change by portioning
the remaining space.
But reading the text made me insecure about such coding.

If the facts should be repeated in more detail I would write
the text above like this:

"Keep in mind:
ClientWidth and ClientHeight can change even when Width, Height stay the same.
For example when the theme changes, the Width and Height remain the same,
but the changed frame reduces ClientWidth and ClientHeight.
This does not happen that often under Windows, but it happens quite often on other platforms."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161107/8ca47294/attachment.html>


More information about the Lazarus mailing list