Question

I need to add a page to TJvWizard at runtime (the page might be registered by plugin). I tried adding it to JvWizard.Pages, but it doesn't seem to be valid way - I need to insert the page as the penultimate page...

I tried the code

AddWizardPage(APage: TJvWizardCustomPage);
begin
if APage <> nil then
  begin
    Apage.Wizard:=JvWizard1;
    JvWizard1.Pages.Insert(JvWizard1.Pages.Count - 1 , APage);
    JvWizardRouteMapNodes1.Invalidate;
  end;
end;

but it is added as the last page on RouteMap, and is displayed at startup as it was first one ...

thanks in advance!

Was it helpful?

Solution

Instead of calling Pages.Insert you must set the Page.Wizard property to the Wizard component. This will set the parent and inserts the page.

procedure TForm1.FormCreate(Sender: TObject);
var
  Page: TJvWizardCustomPage;
begin
  Page := TJvWizardWelcomePage.Create(Self);
  Page.Wizard := JvWizard1;

  JvWizard1.ActivePage := Page;
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top