[lazarus] TNotebook vs TTabbedNotebook

Marc Weustink Marc.Weustink at cuperus.nl
Mon Jan 10 06:02:21 EST 2000


+ From: cwhite at mail.teleport.com [mailto:cwhite at mail.teleport.com]On
+
+ On 09-Jan-2000 Marc Weustink wrote:
+
+ > 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.

I think that one way or the other you are writing duplicate code. In the end
we want to have a TNoteBook, TTabbedNotebook, TPageControl and a
TTabControl.

In this case you have either common code for pages or common code for tabs
and Borland choose for the common tabs. Sure we can decide to create a
common ancestor, but here I can't see how. Unless you also want pages on a
Ttabcontrol, something what is definitely not the purpose of the 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.

Eh... I made that remark unter the assumption that we have a PageControl and
since TPageControl an dTTabbedNoteBook both were decendents of
TCustomTabControl it shouldnt be difficult to create a TPageControl ;-)

Marc






More information about the Lazarus mailing list