You have to keep track of your previous page index manually. For example, in your Next and Previous button's OnClick event handlers, you could do something like this:
procedure TWizardForm.NextClick(ASender: TObject);
begin
SwitchPage(True);
end;
procedure TWizardForm.PreviousClick(ASender: TObject);
begin
SwitchPage(False);
end;
SwitchPage() would look something like this:
procedure TWizardForm.SwitchPage(AForward: boolean);
var
LGotoPage: integer;
begin
LGotoPage := PageControl.ActivePageIndex;
if AForward and (PageControl.ActivePageIndex < PageControl.PageCount) then
inc(LGotoPage)
else if PageControl.PageIndex > 0 then
dec(LGotoPage);
if (LGotoPage <> PageControl.ActivePageIndex)
and AllowSwitchFrom(ActivePageIndex) then
begin
FPreviousPage := PageControl.ActivePageIndex;
PageControl.ActivePageIndex := LGotoPage;
end;
end;
Or something to that effect. :)
Edit: Argalatyr is correct, and I am incorrect, in the case where you want to move through the wizard in sequential order, which I will assume is the case here.
The OnChanging handler does indeed fire, and the page you are coming from is (still) the active page.
The OnChanging event doesn't fire when you set the page index directly, as in my example, so you have to keep track of the old page index. This comes from coding up wizards with optional pages (not sequential).
I should have checked a little better before I posted. Appologies for the incorrect answer.
N@