I’m using a TPageControl with the TTabsheets’ tabs hidden so as to have the frames they contain appear to be stacked, and build some kind of wizard by displaying a different frame at different steps in the process.
Problem is, after calling “PageControl1.ActivePageIndex := x;” to display the next frame, once in the new frame I need to know how I got here, i.e. which frame was previously displayed.
If someone else has used frames in a pagecontrol to build a wizard, how do you keep track of previous/next frames?
Thank you.
TPageControl has an event called OnChanging that is called before the change, and allows you to cancel the change by setting a parameter to false.
You can also use this event to record what page was active before the change.
I would encourage you to make something not as strongly coupled to a gui-component, though. Try to make some kind of class responsible for holding frames and checking if changing from one to another should be allowed and so on. This would make it easier to switch what type of gui control you would use to visualize the wizard. And it would for sure make it much more easier to test to see if your wizard gives the step-by-step progression that you want, if validation rules is enforced and so on.