[Lazarus] New TTabControl

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jul 25 17:36:33 CEST 2011


Felipe Monteiro de Carvalho schrieb:
> On Mon, Jul 25, 2011 at 12:35 AM, Hans-Peter Diettrich
> <DrDiettrich1 at aol.com> wrote:
>>> Your implementation did not work,
>> Which widgetset?
> 
> I think that all of them, or at least gtk2 and carbon. These steps
> failed for me:
> 
> 1> Drop a TTabControl in the form
> 2> Right-click it and select AddTab
> 
> Result: Access Violation

That's why I wrote the note, how to update the widgetsets. When you find 
the place in the source code, where the AV happens, I can try to figure 
out what to do. Or have a look at the places, where I already updated 
the Win32 widgetset.


>> The current implementation reverted TTabControl into a paged control. This
>> step is useless, because it now is a crippled TPageControl with no designer,
>> and incompatible with the Delphi implementation :-(
> 
> My main objective here was fixing the class hierarchy, and that got fixed.
> 
> And for me it works in the designer.

My version also works, including its designer. It also is Delphi 
compatible, in contrast to the paged version. I wanted to use it in the 
EasyDockManager, but now it's as useless as the old implementation :-(


> As for further improving it, one key element here is that the Delphi
> TTabControl is able to receive child elements, so it's not really that
> TTabControl has no sheets, but rather that it always has 1 sheet and
> child controls can be placed on it and clicking in the tabs doesn't
> change which sheet is visible. So that's what Unpaged should implement
> in the widgetsets.

The widgetsets already handle the client area of the native control, no 
need to add any "sheet". Controls of any type can be put into the 
TabControl, when the check for ChildClassAllowed is moved into TPageControl.

As outlined before, a control added to the Tabs.Objects[] will become 
visible when its tab is selected, so that even an unpaged control can 
have individual pages - they only are not restricted to TTabSheet 
descendants.


> And we should also add a AutoSize property, so that people can use the
> TTabControl as a list of tabs without a client area. The AutoSize
> would reduce it's Height to the necessary to show the tabs.

Good idea, but I couldn't find any documentation about implementing 
AutoSize, so I left this to the gurus.

DoDi





More information about the Lazarus mailing list