A mover form allows you to select items in one list and move them to another list. VPM Enterprise provides a Form_Mover form class and the RunMoverForm method of the application object to help you create mover forms.
Mover Form Example
Display the User Lanaguage form in the VPME Sample Application from the Admin-Security-User Language menu option. Click the User Selection button and you will see a form based on the Form_Mover class.
The code that defines and executes the User Selection Languages mover form is in the Click event of the User Selection button in the UserLanguage class in the VPMINT.VCX class library.
Creating a mover form, involves the following basic steps:
1. Load Arrays: At the point in your application where you want to display a mover form you load the "source" and "destination" array properties of the application object. Both arrays are one-dimensional.
2. RunMoverForm Method: You call the RunMoverForm method passing it the parameters that define the mover form. The RunMoverForm method displays the mover form.
3. Use Array: When the mover form closes, you use the destination array for its desired purpose.
The details are shown below.
Ø To create a mover form
1. Load Arrays: Dimension and load two arrays, the “source” and the “destination” using array properties of the application object. The source array should contain all items that can be selected. The destination array should contain those items that have already been selected.
On the Mover form, the source ListBox will only show those items that have not been selected (are not in the destination array).
· Source Array Reference: _SCREEN.oApp.aMoverFormSource[n]
· Destination Array Reference: _SCREEN.oApp.aMoverFormDestination
2. RunMoverForm Method: Call the RunMoverForm method (_SCREEN.oApp.RunMoverForm()) and pass it the parameters that affect how the Mover form looks and behaves. The line that runs the RunMoverForm method should look like this, but with the parameters replaced by values you choose:
llOK = _SCREEN.oApp.RunMoverForm(stlMoverBars,; stlNoSelectionOK,stcFormCaption,stcSourceLabel,; stcDestLabel,stnListBoxWidth,stcMoverClass, stcMoverClass_ClassLibrary)
3. RunMoverForm Method Parameters: The parameters passed to the RunMoverForm method have the following meanings:
· stlMoverBars: Passing “true” causes the destination ListBox to have MoverBars so that the user can change the order of the items. The destination array will also not be sorted. (Logical - Default: .F.)
· stlNoSelectionOK: Passing “true” allows the user to not select any items. It allows the user to have an empty destination ListBox and select OK. Otherwise, the OK button is disabled until an item is in the destination ListBox. (Logical - Default: .F.)
· stcFormCaption: The Mover form's caption. (Character - Default: no caption)
· stcSourceLabel: The caption of the label that appears above the source ListBox. (Character - Default: label is made invisible)
· stcDestLabel: The caption of the label that appears above the destination ListBox. (Character - Default: label is made invisible)
· stnListBoxWidth: The width of the source and destination ListBoxes. The Mover form will resize itself accordingly. (Numeric - Default: 120)
· stcMoverClass: The class from which the Mover form is instantiated. (Character - Default: form_mover)
· stcMoverClass_ClassLibrary: The class library that contains the class from which the Mover form is instantiated. (Character - Default: proforms)
4. Mover Form: The RunMoverForm method runs the Mover form and passes to the form the parameters passed to the RunMoverForm method. Upon the closing of the Mover form, the RunMoverForm method returns (a) “true” if the user has selected OK or (b) “false” if the user has selected Cancel.
5. Return Value: If the RunMoverForm method returns “true”, use the destination array for its desired purpose.