If you use TabControl, Delphi only creates controls for each page when the page is needed (for speed and resource usage). Attempting to access controls on a page that has not been shown will cause problems if you do not call .HandleNeeded. A call to .HandleNeeded tells Delphi that you need a handle now and fixes the problem.
This is not a mistake, by the way. This is an intentional design solution to speed and minimize resource usage, as I mentioned above.
Ken white
source share