tags:

views:

191

answers:

1

Hi, 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!

+2  A: 

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
thank you very much ! :)
migajek