Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

making a wizard interface in delphi 7

I'm using delphi 7 and I'm trying to make a wizard interface. I don't know if there is an easier way to make a wizard, so I was thinking of making separate forms for each step of the wizard, and when the user clicks "Next" the active form closes and the next one opens.

Here's a screen-shot of two successive forms: screen-shot

I've made a procedure that take 2 forms as parameters: the form that will be closed and the next form of the wizard

class Procedure Tspad.nextForm(showForm, closeForm: TForm);
begin
   closeForm.Close;
   showForm.Showmodal;
end;

When I click the "Next" Button the folowing code is executed:

Tspad.nextForm(echipContractForm, clientContractForm);

When i run the program, and i press the "Next" button, the next form apeares but the curent one dosen't close.

How can i make this work, or is there another more efficient way to create a wizard?

like image 919
Mike Spadaru Avatar asked Dec 05 '11 11:12

Mike Spadaru


3 Answers

You can give a try to these :

  • Balmsoft Wizard released under LGPL.
  • Delphi Wizard Framework by SO member Steven R. Kamradt.
like image 96
menjaraz Avatar answered Nov 07 '22 19:11

menjaraz


One very common way to make a wizard is to use a page control. Each distinct page of the wizard is a different page/tabsheet in the page control. I believe that this is effectively how Windows implements wizards.

Naturally you want to hide all the tabs. Do this by setting TabVisible to False for each tabsheet. When you wish to move forwards and backwards through the wizard, e.g. when the user clicks the next or previous buttons, effect this by setting ActivePage or ActivePageIndex depending on your preference.

like image 26
David Heffernan Avatar answered Nov 07 '22 19:11

David Heffernan


A good practise for the division of content being displayed on a single form is the use of Frames.

A Frame is a lot like a form, except it has no Window of its own, but rather sits inside a host Form.

When combined with (as David Heffernan has suggested) a TPageControl or even a TNotebook (which is pretty-much exactly the same as TPageControl, only it doesn't have Tabs to begin with), you end up with an easily-maintainable Wizard.

like image 37
LaKraven Avatar answered Nov 07 '22 20:11

LaKraven