2006. június 7., szerda

Develop a wizard driven style program


Problem/Question/Abstract:

What is the best way to develop a wizard driven style program such as the InstallShield setup programs?

Answer:

Use a TPageControl with each TTabSheet having the property TabVisible set to False. Place Back and Next buttons under the TPageControl and add:

YourPageCtl.SelectNextPage(True);

for the Next button OnClick event, and:

YourPageCtl.SelectNextPage(False);

for the Back button OnClick event.

One caveat. During design-time TabVisible has no effect, and so when you run the program, all of your controls on the TPageControl will shift up by the TabHeight! That's why it's a good workaround to set TabHeight to 1, so that the difference between run-time and design-time is as small as possible.

An even better workaround would be (if you use TabSheets with TabVisible := False) to change the tab style to buttons. Although they are not visible at runtime, they do stop that infuriating extra border.

Nincsenek megjegyzések:

Megjegyzés küldése