Moving from MZ-Tools 3.0 to 8.0 Part 32: A Code Explorer

The build released on January 1, 2017, introduces another very requested feature: a Code Explorer. This feature provides you a list with all the code elements of the active code window:

The Code Explorer shows the code elements of the following kinds:

  • Constants
  • Fields
  • Enums
  • Events
  • User-Defined Types
  • Properties
  • Methods

On the toolbar there are seven toggle buttons to show/hide the code elements of a particular kind. Here you can see the Code Explorer showing only fields:

Furthermore, to the right of the toolbar you have a textbox to enter any text, so that only the code elements containing that text are shown:

And selecting any code element in the list shows it in the code window. I hope that you find this tool productive to locate your code faster!

Moving from MZ-Tools 3.0 to 8.0 Part 31: It’s about time: A line indenter and line indentation review

In build (May 1, 2016) two new features have been introduced: a line indenter and a line indentation review (part of the Review Quality feature).

The line indenter has been the most requested feature in the last years, and after all these months working on bug fixes since the release of MZ-Tools 8.0 for VBA/VB6/VB5 on October 2015, finally this new feature has been added:


The line indenter uses the Tab Width that you have defined in the Options window of VB/VBA (Editor tab, Code Settings section) and is customizable through a couple of options in the Options window of MZ-Tools, Team Options tab, Line Indenting section:


The line indenter works without additional dialogs if the cursor is inside a method, or otherwise it shows a dialog to select the scope (project, file, etc.). Handy menu entries in the context menu of the Project Explorer are also provided.

But the line indenter is only half of the story. Wouldn’t be nice to know which methods have some line that is not correctly indented? The new Line Indenting Review, which is part of the Review Quality feature, provides that information:


When executed, it reports the first line of each method whose indentation is not correct:


So, with these two new features you can be more productive, get your code more formatted and you can increase the quality of your source code.

Moving from MZ-Tools 3.0 to 8.0 Part 30: Other minor features and enhancements

In this last post of the Moving from MZ-Tools 3.0 to 8.0 series, other minor features and enhancements will be mentioned:

The Autosave open documents feature allows you to save automatically the modified files periodically. It is configured in the Options window, Personal Options tab, Open Documents Autosaving section:


The Duplicate Current Line feature is present in many text editors and MZ-Tools 8.0 provides it too, although only through a keyboard shortcut:


The Default Properties feature can now be applied to a control on demand, not only when a control is added to a form:


And default properties can be applied to forms too, not only to controls:


The Open Build Output Folder feature adds a handy menu entry to a project in the Project Explorer to open the folder where the executable is generated:


The Sort Alphabetically Selected Lines feature is also handy in some scenarios, to sort lines of code.

For VBA, you have now a handy Export Files to export all the files of a VBA project to a folder.

In the Moving from MZ-Tools 3.0 to 8.0 series, we have seen all the new features and enhancements that were introduced after the MZ-Tools 3.0 version for VB6/VB5/VBA (released in October 2001) during many years in the versions 4.0, 5.0, 6.0 and 7.0 for Visual Studio, until the unified version 8.0 for all IDEs was released in October 2015. MZ-Tools 8.0 provides more features, allows more customization and flexibility, removes limitations of the version 3.0, improves the user interface, etc. with the goals of making you more productive and enhancing the quality of your projects. Thanks to the feedback received during all those years, it has become the great product that it is today.

Moving from MZ-Tools 3.0 to 8.0 Part 29: Copying files between projects

Sometimes you may need to copy files between projects. For that purpose, MZ-Tools 8.0 introduces a new feature, the Copy Selected Files to Folder, which appears on the Other Utilities toolbar or menu, and on the context menu of a file in the Project Explorer:


Once invoked, the feature allows you to select the destination folder:


To perform the reverse operation, MZ-Tools 3.0 already offered a way to add multiple files to a project, but only using the Ctrl+D keyboard shortcut assigned to the Add File built-in feature. MZ-Tools 8.0 offers a more intuitive way through a new “Add Multiple Files…” menu entry on the Project menu or context menu, along with the other “Add…” menu entries:


Moving from MZ-Tools 3.0 to 8.0 Part 28: The Switch Assignment

A new feature of MZ-Tools 8.0 is the Switch Assignment, a handy feature that allows you to swap the members of an assignment between variables. For example, suppose that you have a Person user-defined type with three fields (Id, FirstName and LastName) and a form with three textboxes. When you load the form, you want to show the values in the textboxes with this subroutine:


When the form is closed, you want to fill the user-defined type with the new values from the textboxes. You can copy the code from the previous subroutine:


And with the cursor on the first assignment you invoke the Switch Assignment feature:


Notice that the assignment has been swapped and the cursor has been moved to the next line, ready for a new operation. But you can select several assignments:


And swap all of them with one click:


So, the Switch Assignment feature can save time performing those mechanical operations, allowing you to become more productive.

Moving from MZ-Tools 3.0 to 8.0 Part 27: The Spell Checker

Another new feature of MZ-Tools 8.0 that wasn’t in MZ-Tools 3.0 is a spell checker for the Caption property of controls and for the text of MsgBox statements. The Spell Checker is configured in the Options window, Team Options tab, Quality Review > Spell Checker section, where you can specify the language and what to review:


It is part of the Quality Review feature:


The Spell Checker requires Microsoft Word (it uses automation behind the scenes). Its output uses the same results toolwindow than the other reviews:


With this new feature you can improve the quality of the user interface of your projects, ensuring that the texts shown to the user don’t have spelling errors.

Moving from MZ-Tools 3.0 to 8.0 Part 26: Converting multiple fields to properties

MZ-Tools 3.0 already offered a Convert Field to Property feature that allowed you to transform a public field of a class into a property. However, if you needed to convert multiple fields, you needed to do it one by one, which required extra clicks.

MZ-Tools 8.0, when converting a single field, works like MZ-Tools 3.0. You start by putting the cursor on the line of a field:


Then you invoke the Convert Field to Property feature to get a dialog to review the values:


And after clicking the Insert button you get the new code:


While the cursor is positioned on the next line to start a new cycle with the next field, MZ-Tools 8.0 allows you to select multiple fields:


And then, when invoking the Convert Field to Property dialog, notice in the caption that there will be several conversions:


And after clicking the Insert button several times you get the whole new code:


So, this is another area where MZ-Tools 8.0 can make you more productive saving extra clicks if you need to perform multiple field to property conversions.

Moving from MZ-Tools 3.0 to 8.0 Part 25: Private Clipboards enhancements

Another very used feature of MZ-Tools 3.0 that has been enhanced in MZ-Tools 8.0 are the Private Clipboards. Now you have “Copy To” and “Paste From” dropdowns on the Main toolbar, to provide better accessibility if you want to use the mouse instead of keyboard shortcuts:


The private clipboards are now editable so you can type anything; you don’t need to have code in a window to copy it to some private clipboard:


And since the private clipboards are editable, you can also clear their contents with the provided buttons at the bottom of the window, either individually or all of them at the same time.

With these minor enhancements this feature provides even more productivity and flexibility than the previous version 3.0, and along with the personal Code Library it can save you a lot of time when you need to repeat code.

Moving from MZ-Tools 3.0 to 8.0 Part 24: The enhanced New Method / Property Assistant

A popular feature of MZ-Tools 3.0 was the Add Procedure assistant, especially to generate properties. MZ-Tools 8.0 renames the feature to New Method / Property Assistant and provides quite a few enhancements.

To customize how a method is generated, use the Options window, Team Options tab, New Method / Property Assistant section, New Method tab, where you can define how you want to name the result variable for functions. The nomenclature can be a fixed value (such as “result”) or use type tags (such as “iResult” for integers, etc.). An example is shown in the preview zone:

NewMethodOptionsFor properties you use the New Property tab, where you can define the nomenclature for the field of the property and for the value parameter. Again, you can use predefined variables for type tags and for the name of the property, and an example is shown in the preview zone:

NewPropertyOptionsOnce configured, you can use the New Method / Property Assistant, which provides more options to customize the generated method and a live preview of the code:

NewMethodAnd for properties, you can specify the style (Standard vs Compact), whether to limit the access of the Let/Set member of the property, etc.:


With these enhancements, MZ-Tools 8.0 can accommodate better your coding style and nomenclature, and can make you more productive, showing a syntax-colored live preview of the resulting code to ensure that it meets your needs.

Moving from MZ-Tools 3.0 to 8.0 Part 23: Generating XML/HTML documentation

Another useful feature of MZ-Tools 3.0 that has been improved in MZ-Tools 8.0 has been the Generate XML / HTML Documentation. In MZ-Tools 3.0 the generated documentation was always XML, but if an XSLT file was specified inside the XML file, when opening it with a browser it was rendered as HTML.

The first improvement is that there are now two different buttons to generate XML and HTML documentation, so that trick is no longer required and you can have pure HTML documentation:

GenerateDocumentationButtonsThe XML documentation generation is configurable in the Options window, Team Options tab, XML Documentation section, where you can specify the output file encoding, whether to document only public declarations or not, and if you want to specify some executable for post-processing of the generated XML file. Furthermore, you can generate the XML documentation automatically, on any folder, when making a VB executable:

XmlDocumentationOptionsThe HTML documentation generation is also configurable in the Options window, Team Options tab, HTML Documentation section, where you can specify the XSL file to transform the XML documentation into HTML documentation. And, as it was the case with XML documentation, you can also generate the HTML documentation automatically when making a VB executable:

HtmlDocumentationOptionsAnother improvement that has been made in the HTML documentation is that now images are shown for different elements such as projects, properties, files, etc.:


With these enhancements, MZ-Tools 8.0 provides greater flexibility and productivity on how you want to generate the XML / HTML documentation of your projects so that the documentation is always in sync with the binaries.