[Lazarus] TOpenGLComponent bug

Albin Pučnik albin.pucnik at guest.arnes.si
Sat Feb 13 14:04:42 CET 2010


Mattias Gärtner schrieb:

>>> 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?
> 
> The widgetset values should only include the widgetset things.
> 
> Maybe you want new properties AdjustedClientWidth, AdjustedClientHeight. 
> Changing ClientWidth/ClientHeight would be a big change and some third 
> party controls rely on that.
> Note: The LCL ClientWidth/Height are not compatible to the VCL, so 
> Delphi compatibility is irrelevant here.

I came across the various client sizes in my attempt to better document 
the LCL. IMO we have the following related areas:

- raw client area (0,0,Width,Height)
- usable client area (excluding bevels...)
- logical client area (in scrolling containers)
- visible client area (visible part of logical area)
- BaseBounds (undocumented???)

IMO beveled controls should report the usable client area to the outer 
world, by adjusting ClientRect etc. accordingly. Internally they use the 
inherited methods/properties, to get the full client area for painting 
bevels etc.

What about drop down controls (combo boxes)?


> r:=ClientRect;
> AdjustClientRect(r);
This IMO should be what [Get]ClientRect returns.

> SpaceAvailable:=r.Right-r.Left;
This should be what [Get]ClientWidth returns.


> Did you know, that you can anchor controls:
> MyControl.AnchorParallel(akLeft,0,MyControl.Parent);
> MyControl.AnchorParallel(akRight,0,MyControl.Parent);
> 
> This will expand MyControl to the full client area width, excluding the 
> bevels.

???


BTW, the determination of a control on a given screen coordinate also 
could be more straight forward. In the related code I found the 
beforementioned different areas, but the handling looks quite crappy to 
me. Did you ever test this with nested scrolling controls?

I also have to test the docking manager code, with beveled or scrolling 
dock sites. IMO no changes should be required, the specialized (beveled, 
scrolling) controls should encapsulate and hide their special treatment 
of client coordinates from *every* user code.

DoDi





More information about the Lazarus mailing list