Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

PageControl vs NoteBook vs TabControl

23 messages · 13 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I asked this question back in 2007 and asked myself the same question today. I read the answers given to me back then, but still doesn't really make sense.

What's the actual difference between a PageControl, NoteBook control and a TabControl?

Why does Lazarus need three different components that it actual fact does the same thing? Why can't all the "extra" utility functions be merged into one single Tab type component, and then delete the other two?

Mattias answer back in 2007 - not very informative, sorry: -----------------------------------

What is the difference between these two components?

TPageControl is a descendant of TCustomNoteBook and provides a few more utility functions.
-----------------------------------

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 12 lines
Hi, I asked this question back in 2007 and asked myself the same question today. I read the answers given to me back then, but still doesn't really make sense. What's the actual difference between a PageControl, NoteBook control and a TabControl? Why does Lazarus need three different components that it actual fact does the same thing? Why can't all the "extra" utility functions be merged into one single Tab type component, and then delete the other two?

Delphi has also 3 components.

1. Pagecontrol is the Win95 version,
2. Notebook is the windows 3.1 component.
3. A tabcontrol is an entirely different beast: it has no pages, just the tabs.

in Lazarus, this last control is simply buggy, it should be fixed. The second can be deleted, as lazarus never worked on Windows 3.1

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

Michael Van Canneyt het geskryf:

Show quoted text 9 lines
Delphi has also 3 components. 1. Pagecontrol is the Win95 version, 2. Notebook is the windows 3.1 component. 3. A tabcontrol is an entirely different beast: it has no pages, just the tabs. in Lazarus, this last control is simply buggy, it should be fixed. The second can be deleted, as lazarus never worked on Windows 3.1

So that only leaves the PageControl, which I believe is the most used one too. Then please guys, simply delete the other two. Lets make things simple and allow developers to concentrate on fixing one component, not three of the same. At most I would say have two tab-type components, one that uses the native backend tab component and one that is 100% custom drawn. Maybe the latter could be used inside the IDE itself (like Eclipse IDE, Delphi IDE etc does) to support more specialized IDE type features.

Make it the job of 3rd Party developers to implement more duplicate/customized versions of the standard components as external add-on packages.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Felipe Monteiro de Carvalho
to Michael Van Canneyt: Delphi has also 3 components. 1. Pagecontrol is the Win95 version, 2. Notebook is the…
Michael Van Canneyt wrote
in Lazarus, this last control is simply buggy, it should be fixed. The second can be deleted, as lazarus never worked on Windows 3.1

Actually this is wrong. In Delphi the Notebook has no tabs and no border, so it is something completely different from TPageControl and it can be used to create assistent-like dialogs. Instead of having lot's of very similar forms, have just one and each screen of the same form is in a different page of a TNotebook. You can't use TPageControl for that because it has a border, which is unwanted for this functionality.

The Lazarus TNotebook is implemented wrong, it's implemented as if it was the same thing as a TPageControl. It should eventually be fixed, but what prevents this is that it is widely used at the moment.

Felipe Monteiro de Carvalho

Reply by email

Michael Van Canneyt
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 6 lines
Just continuing ... TNotebook is widely used as a TPageControl because first someone created the wrong TNotebook and only later TPageControl was added ... The IDE itself uses TNotebook in lot's of places, while it should actually be using TPageControl.

Exactly.

Michael.

Reply by email

Vladimir Zhirov
to Michael Van Canneyt: Delphi has also 3 components. 1. Pagecontrol is the Win95 version, 2. Notebook is the…
Michael Van Canneyt wrote 7 lines
1. Pagecontrol is the Win95 version, 2. Notebook is the windows 3.1 component. 3. A tabcontrol is an entirely different beast: it has no pages, just the tabs. in Lazarus, this last control is simply buggy, it should be fixed. The second can be deleted, as lazarus never worked on Windows 3.1

I would vote against the deletion of TNotebook, since it seems to be the only control that allows creating "multipage" panels with invisible tabs and switch the visibility of pages at runtime under all widgetsets.

TPageControl had some problems with hiding tabs under GTK-2 so for some time TNotebook was the only convenient solution.

If these problems are fixed, and TPageControl can fully replace TNotebook, then these are good news.

Reply by email

Mattias Gaertner
to Felipe Monteiro de Carvalho: Just continuing ... TNotebook is widely used as a TPageControl because first someone…
Show quoted text 6 lines
Just continuing ... TNotebook is widely used as a TPageControl because first someone created the wrong TNotebook and only later TPageControl was added ... The IDE itself uses TNotebook in lot's of places, while it should actually be using TPageControl.

It does not use the specials of TNoteBook, so it should be easy to change that.

Mattias

Reply by email

zeljko
to Mattias Gaertner
Mattias Gaertner wrote 12 lines
On Thu, 4 Mar 2010 11:48:30 -0300 Felipe Monteiro de Carvalho wrote: > Just continuing ... TNotebook is widely used as a TPageControl because > first someone created the wrong TNotebook and only later TPageControl > was added ... > > The IDE itself uses TNotebook in lot's of places, while it should > actually be using TPageControl. It does not use the specials of TNoteBook, so it should be easy to change that.

Well, IDE source editor uses TNoteBook.Options (nboShowCloseButtons comes to my mind), which isn't available on TPageControl.

Reply by email

Flávio Etrusco
to Mattias Gaertner: On Thu, 4 Mar 2010 11:48:30 -0300 It does not use the specials of TNoteBook, so it should…
Mattias Gaertner wrote 15 lines
On Thu, 4 Mar 2010 11:48:30 -0300 Felipe Monteiro de Carvalho wrote: > Just continuing ... TNotebook is widely used as a TPageControl because > first someone created the wrong TNotebook and only later TPageControl > was added ... > > The IDE itself uses TNotebook in lot's of places, while it should > actually be using TPageControl. It does not use the specials of TNoteBook, so it should be easy to change that. Mattias

I've just noticed the although TabPosition isn't published in TNotebook it's actually implemented in gtk and public. Is it implemented in Windows?
If so, can it be published? And can the attached patch be accepted? ;-)

Best regards,
Fl?vio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sourceeditor_vertical_tabs.svndiff
Type: application/octet-stream
Size: 11986 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100304/6fa666ae/attachment-0001.obj>

Reply by email

Hans-Peter Diettrich
to Graeme Geldenhuys: Michael Van Canneyt het geskryf: So that only leaves the PageControl, which I believe is…
Show quoted text 12 lines
> Delphi has also 3 components. > > 1. Pagecontrol is the Win95 version, > 2. Notebook is the windows 3.1 component. > 3. A tabcontrol is an entirely different beast: it has no pages, just the tabs. > > in Lazarus, this last control is simply buggy, it should be fixed. The > second can be deleted, as lazarus never worked on Windows 3.1 So that only leaves the PageControl, which I believe is the most used one too. Then please guys, simply delete the other two.

The TabControl has its use, too. Even if it's buggy, I use it in my docking notebook.

DoDi

Reply by email

Marc Weustink
to Felipe Monteiro de Carvalho: Just continuing ... TNotebook is widely used as a TPageControl because first someone…
Felipe Monteiro de Carvalho wrote
Just continuing ... TNotebook is widely used as a TPageControl because first someone created the wrong TNotebook and only later TPageControl was added ...

Not entirely. In the early days of lazarus, the original TNotebook was correct. Then someone thought, we need a TPageControl and it looks like a TNotebook, lets derive it from a TNotebook. And there the mess started. Hierarchy wrong, properties wrong etc...

Marc (always found it a bad idea)

Reply by email

Felipe Monteiro de Carvalho
to Flávio Etrusco: On Thu, Mar 4, 2010 at 3:00 PM, Mattias Gaertner I've just noticed the although…

2010/3/4 Fl?vio Etrusco :

I've just noticed the although TabPosition isn't published in TNotebook it's actually implemented in gtk and public. Is it implemented in Windows? If so, can it be published? And can the attached patch be accepted? ;-)

I think it's a nice effort, but wouldn't it be better to improve the correct control (TPageControl) instead of making the wrong control better at what it isn't supposed to do?

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Felipe Monteiro de Carvalho: 2010/3/4 Fl?vio Etrusco : I think it's a nice effort, but wouldn't it be better to…
Felipe Monteiro de Carvalho wrote
I think it's a nice effort, but wouldn't it be better to improve the correct control (TPageControl) instead of making the wrong control better at what it isn't supposed to do?

Wouldn't it be better to simply have one tab-type component? All efforts placed on only improving one component?

Say way you want, but LCL is *not* VCL (and will never be), and everybody has been using non Delphi compatible PageControl & Notebook control for 10 years now (how ever long Lazarus exists for). So nobody had issues until I mentioned the duplicated efforts. I think it's more important in directing the little resources Lazarus team has to make the components they have more stable. Start by removing duplicate components. PageControl, TabControl, Notebook - all duplicates one one or two minor differences. Not enough to justify 3 separate components which over all do the same thing.

[...I'll continue my other thoughts in a new thread...]

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Andreas Schneider
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Wouldn't it be better to simply have one tab-type component? All efforts placed on only improving one component?

Here's a problem: TNotebook is _not_ a tab-type component (well, actually it shouldn't be a tab-type component). The Delphi implementation is more or less just a page manager so you can have several layers on one form that you can switch between. That's why it would also be important to have no borders on it. IMHO it's a very useful component (if implemented like in Delphi) - at least for smaller self-contained dialogs where frames would be "too much".

Show quoted text 9 lines
Say way you want, but LCL is *not* VCL (and will never be), and everybody has been using non Delphi compatible PageControl & Notebook control for 10 years now (how ever long Lazarus exists for). So nobody had issues until I mentioned the duplicated efforts. I think it's more important in directing the little resources Lazarus team has to make the components they have more stable. Start by removing duplicate components. PageControl, TabControl, Notebook - all duplicates one one or two minor differences. Not enough to justify 3 separate components which over all do the same thing.

A TabControl in contrast to a PageControl has _no_ pages. It really only consists of tabs, so it isn't a container in any way. So a PageControl is essentially a TabControl+Notebook. The "problem" here is, that for PageControls there usually exists an implementation on the several widgetsets so we can't just use TabControl+Notebook if we want the platform specific look. That doesn't however negate the specific usecases for TabControl and Notebook (see above).
I think the current PageControl and TabControl implementations are right (and they really differ from each other). But as was said earlier in this thread, the Notebook is "wrong" (and therefore currently more or less useless). The consequence still shouldn't be to remove it, but to fix (rewrite?) it. Since it will be a custom control then anyway, the future maintanence should be rather low, since we don't have any widgetset dependence.

Best Regards,
Andreas

Reply by email

George Lober
to Graeme Geldenhuys: On 5 March 2010 14:24, Felipe Monteiro de Carvalho Wouldn't it be better to simply have…
Graeme Geldenhuys wrote 23 lines
On 5 March 2010 14:24, Felipe Monteiro de Carvalho wrote: > I think it's a nice effort, but wouldn't it be better to improve the > correct control (TPageControl) instead of making the wrong control > better at what it isn't supposed to do? > Wouldn't it be better to simply have one tab-type component? All efforts placed on only improving one component? Say way you want, but LCL is *not* VCL (and will never be), and everybody has been using non Delphi compatible PageControl & Notebook control for 10 years now (how ever long Lazarus exists for). So nobody had issues until I mentioned the duplicated efforts. I think it's more important in directing the little resources Lazarus team has to make the components they have more stable. Start by removing duplicate components. PageControl, TabControl, Notebook - all duplicates one one or two minor differences. Not enough to justify 3 separate components which over all do the same thing.

Assuming the direction is to have Delphi compatibility, removing components which exist in Delphi IMO is a mistake.

I write for Windows and use Delphi (currently 2010). Do I feel Lazarus can replace Delphi for my Windows development? No. Or that I can easily switch from Lazarus to Delphi? No. Therefore I am committed to using Delphi for my main code writing.

Although Lazarus is compatible with Delphi in many respects, one is forced to choose one over the other. It is just not practical to switch between the two on a frequent basis. This is even more the case with D2010 then with D7.

One of the biggest bothers for me if I want to test my app (45k lines of code, 26 forms, 1400+ controls) on Lazarus is the conversion. This includes differences in components and/or differences in properties. Do I want to spend a couple of days converting every time I want to compile under Lazarus? No thanks.

I am sure this is counter to other opinions (probably bordering on heretical on this list) or what may be practical given the work load priorities, but for the sake of ease of switching between Delphi and Lazarus, I would actually prefer to have dummy non-working properties in controls (documented as such), rather than have them missing altogether. If they are not important enough to have, why not just have non-working value containers.

Just some chatter from a Delphi user. If anybody reading this thinks this scenario and opinion is in the minority and/or of little importance, feel free to ignore this message.

Reply by email

Graeme Geldenhuys
to Andreas Schneider: Here's a problem: TNotebook is _not_ a tab-type component (well, actually it shouldn't be…

Andreas Schneider het geskryf:

Show quoted text 5 lines
Here's a problem: TNotebook is _not_ a tab-type component (well, actually it shouldn't be a tab-type component). The Delphi implementation is more or less just a page manager so you can have several layers on one form that you can switch between.

To me, that is exactly what a tab-type component is.

That's why it would also be important to have no borders

Well how hard can it no be to add a new "with borders" or "without borders" property to the TNotebook. This minor detail still doesn't justify a complete separate component.

on it. IMHO it's a very useful component (if implemented like in Delphi) - at least for smaller self-contained dialogs where frames would be "too much".

Yes, another option that says: Show/Hide tabs. Again, no reason to have two components that do exactly the same.

A TabControl in contrast to a PageControl has _no_ pages. It really only consists of tabs, so it isn't a container in any way.

Fine, I can see the difference with a TabControl, but the difference between a PageControl and a Notebook control is stupid. The later two could be rolled into one single component.

So a PageControl is essentially a TabControl+Notebook.

OS/2 has Notebook control that displayed tabs. So does many X11 widgetsets. I believe so does the Delphi Notebook control. It's just a different name for the exact same thing.

Rolled into one, they would reduce maintenance, increase stability (because everybody use the same component).

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Felipe Monteiro de Carvalho
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Well how hard can it no be to add a new "with borders" or "without borders" property to the TNotebook. This minor detail still doesn't justify a complete separate component.

Except that because components are drawn by the widgetset, which doesn't support this no-borders at least in the case of Windows, you sure can offer this property, but then you need to have 2 implementations for the same control.

The correct TNotebook can be implemented purely in LCL code, so not that much work in maintaining it.

Rolled into one, they would reduce maintenance, increase stability (because everybody use the same component).

Only if you draw everything yourself like in fpgui. With the LCL design and the limitations of widgetsets this isn't true.

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Felipe Monteiro de Carvalho

Felipe Monteiro de Carvalho het geskryf:

Show quoted text 8 lines
The correct TNotebook can be implemented purely in LCL code, so not that much work in maintaining it. > Rolled into one, they would reduce maintenance, increase stability (because > everybody use the same component). Only if you draw everything yourself like in fpgui. With the LCL design and the limitations of widgetsets this isn't true.

OK, so LCL should be able to reduce TPageControl, TNoteBook and TTabControl to just two components. Not much of a saving, but their is still an advantage.

eg:
TPageControl - LCL wrapper around native tab widget. TNotebook - 100% custom drawn using only LCL painting and supports the option to hide pages and only display tabs. And do Border or No Border pages etc. So this component could double as a TTabControl too.

The TNoteBook could then be used in Lazarus IDE to implement more features that will be handy for an IDE to have. eg: Tabs or right/left/top/bottom, Close tab button on each tab, different tab looks (like Eclipse and Delphi already does), etc... and guaranteed that it will work on all platforms.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email