Changing Converted Screens to Visual FoxPro Forms

See Also

Converted FoxPro 2.6 screens run in a compatibility mode provided by the WindowType property. To understand how the Visual FoxPro architecture supports the screens in READ compatibility mode, see Overview of READ Compatibility Architecture.

The following table describes the basic feature mapping in converted screens.

FoxPro 2.6 screen feature Visual FoxPro feature
Screen set Form set
Screen Form contained in a form set
READ level Page contained in a page frame
READ screen mode WindowType property = 2
READ MODAL screen mode WindowType property = 3

You can change converted screens to run directly from the .SCX file. To remove the need for the .spr file created during conversion, you might need to change any files that call the converted screen. You might also need to move code from the .SPR file to the converted screen (.scx file).

You can change converted FoxPro 2.6 screens to the Visual FoxPro event model.

To change converted screens to Visual FoxPro forms

  1. Change the WindowType property from 2 (Read) to 0 (Modeless), or from 3 (Read Modal) to 1 (Modal).

    Note When you make this change, the READ compatibility properties and events are no longer available and the WindowType setting cannot be changed back.

  2. If you have a single form, move form set event code to the matching or appropriate form events and remove the form set.

  3. Move code from the READ-compatibility events to the form events and methods that are now available, taking event firing sequences into account. For more information on the event firing sequence, see “The Visual FoxPro Event Sequence” in Chapter 4, Understanding the Event Model, in the Developer’s Guide.
    Read-compatibility events Form events and methods
    ReadActivate event
    ReadDeactivate event
    ReadShow event
    ReadValid event
    ReadWhen event
    Activate event
    Load event
    Show method
    Deactivate event
  4. Remove page and page frame controls that are extraneous.

  5. Process parameters in the Init event of the form instead of the screen Load event.

  6. Replace preprocessor constants that mapped to property settings with the evaluated value.

  7. Property settings in Visual FoxPro are not preprocessed. They must contain actual values or expressions that can be evaluated at run time. Method and event code is preprocessed, and constants defined there will be evaluated correctly.

  8. Adjust scoping of variables in events or methods, which are private by default, by using the PUBLIC, PRIVATE, or LOCAL commands or by adding properties to the form.

    For details on scoping, see Scope of Data Containers.

  9. To run the form directly, move code from the generated .SPR file to appropriate methods in the form.

Note The Visual FoxPro 3.0 defaults in the FontSize, FontBold, and ColorSource properties differ from the Visual FoxPro, version 5.0 and later defaults in the same properties.

For more information, see Converting Visual FoxPro 3.0 Files. Also see Scope of Data Containers, and Tracking Event Sequences.