[Lazarus] TCustomNotebook (was: TListView review required)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jul 4 16:53:11 CEST 2011


Felipe Monteiro de Carvalho schrieb:

>> I'd second that idea, currently I'm working on such an improvement for
>> tabbed controls. The TCustomNotebook suffers from the added pages, which
>> should be added only in a derived control, as special kind of owner data.
> 
> Ummm, not really. Please note that TCustomNotebook is just a wrongly
> named component, it must have the tabs because huge amounts of code in
> the LCL depend on that. This component is scheduled for being renamed
> to TCustomPageControl.

Yes, I realized that misinterpretation already. If somebody is willing 
to update the widgetsets accordingly, I can do all the required LCL and 
IDE updates right now. (see below)

> It seams that you are mixing TCustomNotebook with TNotebook, but they
> are completely unrelated.

No, I don't confuse these, but I admit that something should be renamed.

> TCustomNotebook is almost the same as
> TPageControl and it is a native control.

That's not true, at least not for Win32. The native Win32 TabbedCtrl has 
no idea of pages, that's a Delphi/Lazarus addition that could have been 
implemented in a *derived* control.


Now for the good news:

I just finished the revised implementation of TCustomNotebook, so that 
it can work with and without pages. In that approach I didn't rename 
TCustomNotebook, because this is the type used in the widgetsets (see 
above). But I made some methods abstract, and derived two new 
(intermediate) classes:

- TPagedNotebook is the old implementation, for use in e.g. 
TPageControl. I've redirected all derived controls in the LCL to this 
new class. The IDE continues to work, no new bugs seem to be introduced.

- TCustomTabs/TTabs is the new tabbed control, without pages/tabsheets.
This is a direct replacement for the T[Custom]TabControl, far more 
compatible with the Delphi implementation than the current 
implementation. Some properties still wait for their implementation in 
the various widgetsets.

I've left the old TTabControl in ComCtrls, for reference purposes during 
my development, and to allow for easier access to (currently) private 
elements in TCustomNotebook. The new TTabs can be renamed and moved 
there, after approval. The new TTabs does not require an additional page 
control, no separate page list, and no additional page controls, what 
reduces the resource usage (HWND...!) a lot.

I'm just thinking about makeing the Tabs.Objects[] optional pages, as 
outlined in the TabTest application. It doesn't make a difference to the 
  tabbed control, whether it has associated (page/tabsheet) controls at 
all, and whether these controls are shown in its own client area or 
somewhere else. In fact TCustomPage only holds some per-page properties, 
in detail for communication with the widgetsets. TTabs uses a single 
dummy page internally, to keep some internal methods and the widgetsets 
happy.





More information about the Lazarus mailing list