Remove/Change the FormSet and Form

If there is only one Form in the FormSet, the FormSet should probably be removed (leaving the form, of course). But before doing this, all code in the FormSet events must be moved to the appropriate places in the Form events, otherwise the code will be removed along with the FormSet.

If there is more than one Form in the FormSet, the FormSet cannot be removed.

Change the FormSet WindowType Property and Move Event Code

If the FormSet will not be removed, several changes should be made to it. First, the WindowType property should be changed from 2 (read) or 3 (read modal) to 0 (modeless) or 1 (modal). This change will require the code in the FormSet ReadWhen, ReadActivate, ReadShow, ReadDeactivate, and ReadValid code to be moved to other events because they will not fire when the FormSet WindowType property is 0 or 1. The code in ReadWhen, ReadActivate, and ReadShow should be moved to the FormSet Show and Activate events, with care being given to make sure that sequence that the code will execute is correct. Note that the event firing sequence in FoxPro 2.x is When, Active and then Show, while the event firing sequence in Visual FoxPro is Show and then Activate.

If the FormSet will be removed, The FormSet Read... events should be moved to the Form Show and Activate events, with the same care given to the sequence that the code will execute (as described above). Additionally, the FormSet Load code should be moved to the Form Load event.

Parameters are passed to the FormSet Load event when the FormSet WindowType = 2 or 3 and to the FormSet Init when the FormSet WindowType = 0 or 1. All parameter handling code will need to be moved to the Init event of the FormSet if the FormSet is not removed or to the Init of the Form if the FormSet is removed.

Create FormSet or Form Properties for Variables created in FormSet Load

When the FormSet WindowType property is not 2 or 3 or the FormSet is removed, no special scoping of variables created in the FormSet Load or Form Load occurs. Properties should be added to the FormSet for each variable needing to be scoped to the FormSet. If the FormSet is removed, these properties should be added to the Form instead. Properties also should be added to the Form for variables needing to be scoped to the Form.