Updated and Open Source CanTools Wizards

In the very early days of Delphi I wrote a collection of IDE plugins I called" Cantools Wizards" and made available for free in binary format. The old page is still at https://www.marcocantu.com/cantoolsw/ (I'll update it, time permitting).

The original collection had more wizards, but some are very old (like the database wizard) or don't work great or have been replaced by features of the IDE (like the clipboard history, added and recently removed for performance and security reasons). At this time the open source version for 10.4.x has only two wizards, activated by an add-on menu in the IDE (under Tools).

Rebuild Wizard

The Rebuild Wizard allows you to select all projects in a folder (and its subfolders), open them all, and build them all. This is the UI:





The list button fills the list below with projects in subfolders, and the other buttons have options for building all of the projects or opening and building one. Notice that if you look at the source code you can see that there isn't a OpenToolsAPI for compiling, so the wizard activates the matching IDE menu item.

OOP Form Wizard

This wizard allows you to hide the published components of a form, making your form more object-oriented and providing a much better encapsulation mechanism. You activate it while a form is the active module in the editor, and it creates for you an OnCreate event handler with instructions to set each field to the matching component. It also generates a RegisterClass call you need to manually move to the initialization section of the unit. You also need to manually move the component fields to the private section of the form class declaration. 

This is the code the wizards adds to a very simple form:

And this is how you should manually update it:

The value here is for a form with dozens of components and a project with dozens of forms, as the wizard is fairly limited, but the code it generated would be very tedious to write directly.

The GitHub Project

As mentioned, this time round I published the code for the current subset of wizards on GitHub with an MIT license at https://github.com/marcocantu/cantools

The code is very old, and not very clean (or even fully matching standard Delphi coding conventions), but I think it is fairly instructive in the way it hooks to ToolsAPI and the IDE, with hooks to the About box and splash screen. I plan adding a couple more of my other old wizards to it.

You can also find the ready-to-use binary at https://www.dropbox.com/s/whflj6062tiscb8/cantools_104.bpl