[Lazarus] cannot understand popup menu and form not-closing
Roberto Padovani
padovani.r at gmail.com
Fri Feb 12 17:26:14 CET 2010
2010/2/12 Mattias Gärtner <nc-gaertnma at netcologne.de>:
> Zitat von cobines <cobines at gmail.com>:
>
>> 2010/2/12 Paul Ishenin <ip at kmiac.ru>:
>>>
>>> Bevels reduce ClientRect by BevelSize value.
>>
>> I thought so that they're supposed to do that, but if I put a TPanel
>> on a form with a outer bevel set to Lowered , the panel's ClientHeight
>> = Height.
>
> Bevel reduces the AdjustClientRect, which is ClientRect minus the Bevels.
> ClientWidth is the client area width from the widgetset. The bevels are
> custom drawn by TPanel and therefore not in the ClientWidth of TPanel.
>
Ok, that clears up why ClientWidth=Width. But why the bevels are
included in ClientRect? I think child controls are not supposed to
occupy the bevels' space. Can the ClientWidth, ClientHeight from the
widgetset be adjusted to include bevels?
For example if I want to check how much space is in the Panel for a
control, I do:
SpaceAvailable := Panel.ClientHeight;
if SpaceAvailable >= 100 then
ShowMyControl_of_size_100_or_more (because I'm sure it will fit)
else
HideMyControl... (don't want to show it partially)
(The Panel size is controlled by the user.)
However, if TPanel contains bevels then the space available for the
child control is ClientHeight - BevelSize * 2. I have to take it into
account when calculating space. Otherwise, either my control will not
be fully shown, or it will be drawn over the bevels. Is there some
other property I can check that will include all borders, bevels,
etc.?
>>> BevelSize is used to calculate the ClientRect in
>>> TCustomPanel.AdjustClientRect.
>>
>> Yes, that function recalculates the rectangle correctly, but it seems
>> it's somehow not propagated to the auto size algorithm or to the
>> stored client rectangle.
>
> The autosize algorithm uses AdjustClientRect.
It still puts child controls over the bevels. I don't know, maybe I'm
confusing it with aligning child controls. It is supposed to either
make the child control smaller so that it doesn't overwrite the
bevels, or make the TPanel bigger so that the child control fits in
whole and there's still space left for the bevels.
> Please add an example to demonstrate the problem.
I have found an already existing bug on this with a good example. But
it said the problem is only for BevelWidth > 1 and only for GTK, GTK2.
I confirmed this issue also on QT and with any bevel width. I'll check
later on Win32.
Unfortunately Mantis died on me while I was reading it so I didn't get
the bug number. Will try later.
--
cobines
More information about the Lazarus
mailing list