Getting a Ttab*** to show on start-up



I must have a blind spot with the following problem.

On A TpageControl I have a number of Ttabsheets. All tabsheets contain a
Tpaintbox on a Tscrollbox; the first one also has other controls.

During execution, in response to menu selection and other user actions, I
can set focus to the first tab*** via
pagecontrol.tabindex:=0 or pagecontrol.activepage:=tabsheet1
It works as it should: the first tab***'s tab is focus-marked and its
contents are displayed.

I want the same to happen when the program starts (in case I've forgotten to
select the first tab*** in the designer). The program starts with a Ttimer
that fires after a short delay so that I can be (reasonably) sure that all
the initialization sections have been executed and all the forms loaded. In
the OnTimer handler I disable the Ttimer and then set the active page of the
Tpagecontrol as above, followed by loading of files, building images, etc.
What happens is that the first tab gets the focus mark but the image of the
pagecontrol is of the tab*** that was selected in the designer. When I
click the first tab nothing changes (I guess because it already has the
focus). When I click the 'designer' tab the image doesn't change (since it
is already what it should be) and the corresponding tab now gets the focus
mark. Only after clicking the first tab after clicking the other or a third
tab will display the proper image of the first tab.

I have tried repainting the Tpaintbox of the first tab after setting the
activePage. To no avail.
I have mimicked the start-up by triggering the timer during execution.
Response is then correct.
I have increased the timer interval. No use.

Any further ideas anybody?
Tom


.


Quantcast