Question

I have an application using TNotebook to switch between different sub pages, that are shown.

Now I have to extend this code a little bit (namely add a page and change sizes).

I was told that TNotebook shouldn't be used anymore. In Delphi's help I find "New applications should use TPageControl".

My question: Should I refactor the code to use TPageControl instead of TNotebook? What are the disadvandtages of TNotebook?

Was it helpful?

Solution

The main advantage of TPageControl, in my opinion, is that it is a system native control, unlike TNotebook. When you use system native controls, the control is painted by the system, and so takes on the look and appearance that is native to the operating system that you use.

When the application is run on a new version of the OS, your control automatically gets the appearance that is native to that OS. What's more, the behaviour is system native. By that I mean the way the control responds to keyboard input and so on. That's less of an issue with TPageControl since the system does not provide that much default behaviour. But as a general rule the advice is sound.

When none of the system native controls meet your specific requirements, you may need to use a non-native control. And then you have to work to make sure that your control adapts to its surroundings. But when there is a system native control, unless there is a strong reason to avoid it, you should use it.

OTHER TIPS

Another disadvantage of TNotebook is that it excludes the form or frame on which it is placed from inheritance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top