Wednesday, December 10, 2008

The Delphi Wizard Framework - Design Decisions

The Delphi Wizard Framework, as I introduced in the previous post, was originally designed to replace a complex configuration system which was put together using a TNotebook component (yes, from the Delphi 1 days) on a single form. The first problem this faced was adding pages was more complex than it needed to be. The second problem was re-using entire pages in another project became a copy and paste fest, with plenty of room for missing a critical event.

My first goal was to take each page out of the single form, and create a form of its own that contains all of the logic just for that page. This worked very well, but I still had the problem where each form had to be added to the uses clause, and a circular reference back to the main containing form didn't feel right. Taking my research into using interfaces outside of COM, I developed a simple interface for the "FormManager" and another for the "FormPage", named IWizardManager and IWizardPage respectfully. When each page is displayed, the formmanager would pass forward its reference and the page would record this for later use.

With that out of the way, I then turned to how to let the system know about each form. I decided that the best way to address that problem would be to use the class registry system already existing in Delphi and call RegisterClass(classname) for each form that will be used. This cuts back on the need to add each unit to the uses clause and makes reuse almost as simple as adding the form to the project. I say almost, as the default behavior of Delphi when a form is added to the project is to auto-create it...this is not necessary with the framework as the framework will be responsible for the creation and deletion of each form.

In my next post, I will discuss form navigation.


Unknown said...

You might take a look into JVCL/JEDI Wizard here ...

Aleksey said...

I also wanted to mention about JVCL Wizard components. =)

Take a look at screenshots at this article. It is originally written in russian, but the Google awfully translated it to English.

Aleksey said...

Not sure, that previous comment was successfully published, so i'll repeat.
I also wanted to mention about Jvcl Wizard.
Take a look at screenshots of JvWizard, if you don't want to install it.