[Lazarus] TCustomNotebook

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Jul 5 03:05:29 CEST 2011


Felipe Monteiro de Carvalho schrieb:

>> 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)
> 
> I already started that a long time ago, I already did the following steps:
> 
> 1> Removed the old wrong TNotebook
> 2> Created a new correct TNotebook
> 3> Today I moved TCustomNotebook from ExtCtrls to ComCtrls

Okay so far, I just realized that Delphi also has the tabbed controls in 
ComCtrls.

>>> 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.
> 
> I don't understand what you mean here. TPageControl is not implemented
> like in Delphi, it does not inherit from the same control as
> TTabControl in the LCL.

Right, that's a big mistake in the LCL :-(

> My statement is correct: In the LCL TCustomNotebook is the same as
> TPageControl. Note that TPageControl is unrelated to TTabControl in
> the LCL

The LCL TTabControl *erroneously* uses *another* TPageControl 
internally, only to show its tabs! Instead it should be based 
immediately on the widget that shows the tabs, e.g. the Windows TabCtrl.

> TCustomNotebook does not exist in Delphi.
> 
> See: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ComCtrls_TPageControl.html

Right, Delphi addresses the TabCtrl widget directly, where the LCL uses 
a TWSCustomNotebook widget.

> It seams that you are proposing to change that, I think the idea is
> interresting, fixing the object hierarchy to be the same as in Delphi.
> But be prepared for a lot of work =)

It's not much work, but the <grmbl> LCL implementation of the 
TWSCustomNotebookClass made it hard to find out a simple solution :-(

Unfortunately I cannot provide my solution right now, due to your move 
of TCustomNotebook etc. into ComCtrls. Before I do more superfluous 
work, can you please specify how I should proceed:

Should I retain T[Custom]TabControl as is, and add another flyweight 
TTabs control,
or should I replace the old implementation by the new one?

Then you'll find in my patch this class hierarchy:

TCustomNotebook //should be renamed into TCustomTabCtrl
   TCustomTabs	//the refactored TCustomTabControl
     TTabs	//the refactored TTabControl
   TPagedNotebook //corresponds to the current T[WS]CustomNotebook
     TPageControl //etc., rebased but otherwise unchanged


IMO it were the right time then, to refactor and rename 
TWSCustomNotebook as well, to reflect above splitted base classes. In 
the simplest solution a few alternative methods should be added, for all 
methods which currently use an TCustomPage parameter. Or this class 
could be splitted in a new TWSTabCtrl base class and a derived 
TWSPagedCtrl class.

DoDi





More information about the Lazarus mailing list