Converting FPW 26 screens


Converting the screens of FoxPro for Windows into the forms of Visual FoxPro is the most difficult part of the process. The Screen Builder in FPW 2.6 saved the design in a pair of files with .scx and .sct extensions and you then had to use a further option to generate a .spr program file from these tables. The Form Designer in Visual FoxPro generates a similar pair of files but their content is very different and the Do Form command uses these files directly.

Visual FoxPro can open screen files from FoxPro for Windows and convert them into the newer format. If you open a FPW screen in VFP then you get a dialog with two options:

[VFP Form Converter]

Neither of these options is really satisfactory and they do not represent the full range of possibilities. You have four choices:

Functional conversion

Functional Conversion gives a form that will run in VFP but in order to be able to cope with any possible situation in FPW 2.6, it will convert even the simplest FPW 2.6 form into a Page of a PageFrame on a Form in a FormSet. Instead of a simple form you will have three nested containers and a design which is far too complex for the vast majority of screens.

The FormSet has a WindowType of 2 or 3 and textboxes on the form have a Style of "2.x @SAY Compatibility". Both these options only exist for converted forms and so Functional Conversion takes you away from the main stream of VFP development into a dead end. Any further work you do will have to work in this peculiar subset of the VFP world.

Visual conversion

Visual Conversion gives you the layout of the form in the usual two files but puts the logic in a separate program file. As with the Functional Conversion, the form files represent a form inside a form set and it too is overcomplex for most forms. Neither the form nor the program will run without some further work.

All the code snippets from the FPW 2.6 screen are saved in a .prg file with the same name as the form. There is not an exact match between the snippets of FPW and the methods of VFP. Functional conversion forces the snippets into some non-standard features of VFP but Visual Conversion avoids this compromise by saving the program code of the snippets in a separate file and allowing the developer to decide how the logic should be implemented as methods of the new form.

Visual conversion requires more work from the developer and leads to a better solution but the VFP design still includes the unnecessary form set.

Do nothing

Doing nothing is an attractive option and can work well as a short-term solution. The two automatic conversions above work on the FoxPro 2.6 screen data files but the screen design also exists in FPW 2.6 in a non-visual form as a FoxPro program with a .spr extension. This program uses the @SAY commands to display the data and the graphical elements of the screen and the @GET command to accept input from the user. These are marked as "backward compatible" elements in Visual FoxPro but they still work.

You should be able to make the minimal alterations to the program code described here and then just run the spr file as a program. You will have lost all links to the visual design tools and you will have to make any changes by using the old FoxPro 2.6 syntax but this might be the best strategy for a form in a little-used area of the application.

Rewrite

In an ideal world, this would be the best solution. The old screen design will have been done to the standards of Windows 3 and will look very old-fashioned in the XP world. It will have a white background and the text will be in a bold MS Sans Serif font. You can of course work through the converted forms and modify the backgrounds and the fonts but you will still have a design from the mid-nineties.

[Fox 2.6 Screen]

The logic behind the forms will also be dated. The code will have had ten years' of maintenance. At best you will be faced with a complex structure of bug fixes and patches. At worst you will have a mess which defies understanding. Take this opportunity to use the best from the existing design and to build a new structure.


Introduction | Data | Program code | Menus | Reports | Screens | Strategy


Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map