1

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!

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
migajek
  • 8,524
  • 15
  • 77
  • 116

1 Answers1

3

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;
Andreas Hausladen
  • 8,081
  • 1
  • 41
  • 44