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:

ShowPerson

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:

FillPersonBeforeSwitching

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

FillPersonAfterSwitchingOneLine

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:

FillPersonBeforeSwitchingMultipleLines

And swap all of them with one click:

FillPersonAfterSwitchingMultipleLines

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