[Lazarus] TCustomNotebook

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


Felipe Monteiro de Carvalho schrieb:
> On Mon, Jul 4, 2011 at 4:53 PM, Hans-Peter Diettrich
> <DrDiettrich1 at aol.com> wrote:
>> 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:
> 
> Have you already commited? It seams like this will conflict big time
> with my changes if you started before them =)

I've not supplied the patch yet, have to move everything into ComCtrls 
first :-(

>> - 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.
> 
> ummm .... some problems with that:
> 
> 1> Please don't name anything related to tab controls as notebook

The widgetsets refer to TCustomNotebook, that's why I cannot change that 
name :-(

> 2> Are you sure that simply using the Delphi hierarchy here couldn't
> be a good choice?

That's just what I implemented: the base class provides a tabbed control 
without pages, the derived classes add pages (tabsheets...) to it.

> 3> Does it work in all widgetsets?

A few modifications may be required, where the widgetset implementation 
assumes that a TCustomPage parameter is for use as a visible control. 
I've found two methods in the Win32 widgetset, which have to bypass some 
work, based on
   if (ANotebook is TPagedControl) then {handle page visibility...}
Otherwise the TCustomPage parameter only contains tab attributes, e.g. 
title = page.Caption.


I do not really understand the complicated handling of the page 
controls, in both LCL and widgetset code. As demonstrated in a simple 
test program for TTabControl, eventually related controls (tabsheets...) 
can become ordinary child controls of the basic tabbed control, with 
only the selected one being made visible. This can be done with other 
controls, too, which can have any suitable Parent (maybe Nil for 
detached floating forms). This approach will also allow to dock controls 
of any kind into a page control, as the EasyDockManager does internally.

DoDi





More information about the Lazarus mailing list