[lazarus] TNotebook vs TTabbedNotebook

Curtis White osiriz at teleport.com
Sun Jan 9 18:09:16 EST 2000



On 09-Jan-2000 Marc Weustink wrote:
> Hi,
> Since the TNotebook and TTabbedNotebook are on the win31 page I didn't
> concern much about them, but here some thoughts. The reason why Borland put
> them on this page is IMO only for backward compatibility. Most of them have
> a good and usable counter part. So in daily development I don't use them
> (except for TNoteBook, I havn't found a replacement).

True. But they can still be useful controls and many people do still use them.
TNoteBook is a very light weight control compared to TPageControl. If you don't
need all the functionality of TPageControl then TNoteBook is much easier to
use. Like you, I use TPageControl instead of TTabbedNotebook now.

> In Delphi 4 (& 3 & 2) TNotebook is a decendant of TCustomControl and
> TTabbedNotebook a decendant of TCustomTabControl. Since we are trying to be
> Delphi compatible I think we should do the same. So TNotebook shoud be just
> a notebook whithout tabs, a plain control with pages. TCustomNotebook
> shouldn't be used anymore and TTabbedNotebook is a decendant of
> TCustomTabControl.

The only problem with this is that much of the code to implement TNotebook and
TTabbedNotebook is identical. If they inherit from two different components,
then much of that code will be duplicated. That seems kind of silly to me to
duplicate code just because Borland did it that way. I think Borland did it
that way because they had to actually build the TNoteBook control from scratch
(they didn't use a Windows notebook control). TTabbedNotebook is created
specifically from a windows notebook control. I don't see any reason we should
build a notebook from scratch like Borland did when one already exists (just
have to turn off the tabs).

Obviously, TCustomControl doesn't contain any notebook functionality. And
TCustomTabConrol contains functionality specific to having tabs. So it doesn't
really make sense to split them that way in Lazarus (my opinion). I think we
could simulate Delphi's way of doing it by creating the TCustomTabControl
and makeing it inherit from TCustomNoteBook. Then we wouldn't be duplicating
code. They would both be inheriting from a single component that contains most
of the functionality of a notebook control.

> This brings me to my feeling of the win31 beeing a compatabiliti page, I
> think that in the IDE develompment we should prefer the use of the
> TPageControl instead of TTabbedNotebook.

I agree with this. But it is going to take a lot more work to implement the
TPageControl. Originally, we just wanted to have a way to make a tabbed
notebook. We can always switch it to a TPageControl in Lazarus once that is
completed.


Curtis






More information about the Lazarus mailing list