How to Create Mover List Boxes in Visual FoxPro
ID: Q142190
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 6.0
SUMMARY
Moverlist boxes are designed to allow for easy point selection of a value
that will display in a parallel list box enabling the user to create a list
of items before proceeding. The code involved to make these list boxes work
properly is very extensive in the Microsoft Visual FoxPro product. In the
Vfp\Samples\Controls\Samples.vcx directory, you'll find a Mover Class that
you can use to quickly create moverlist boxes with very little additional
code. The example given in this article works for most, if not all, users.
MORE INFORMATIONStep-by-Step Example
- Start a Visual FoxPro session.
- On the Tools menu, click Options, and then click the Controls tab.
- Make sure the Visual Class Libraries option is selected, and then
click Add, and select the following library:
Vfp\Samples\Controls\Samples.vcx
Samples should appear in the Selected box of the Options Dialog Box,
- Click Set As Default, then click OK.
- On the system's File menu, click New, click Form, and click New File. A
blank form will appear.
- Click the View Classes Button on the Forms Control Tool Bar, and select
Samples. The Forms Control Tool Bar has now changed.
- Click the Moverlists Button, click in the form, and the moverlists will
appear.
- Place the table that you intend to get the list value(s) from in the
Data Environment of the form.
- Place the following code in the Init event of the form:
SELECT <TABLENAME>
SCAN
THIS.MOVERLISTS1.LSTSOURCE.ADDLISTITEM(<FIELDNAME>)
ENDSCAN
At this point, you can add any additional buttons, controls, or code
depending on what the user would like the list boxes to do.
Steps to Add Selected Items to a Database
If you want to add the selected values to a .dbf file, follow these steps:
- Add the .dbf table to Data Environment of the form.
- Add a Command Button, and place the following code in its Click Event:
SELECT <NEWTABLENAME>
FOR I = 1 TO THIS.PARENT.MOVERLISTS1.LSTSELECTED.LISTCOUNT
APPEND BLANK
REPLACE <FIELDNAME> WITH ;
THIS.PARENT.MOVERLISTS1.LSTSELECTED.LISTITEM(I)
ENDFOR
The records that were selected have now been written to the table of
your choice.
- To immediately see the results of the APPEND command, add:
BROWSE
Additional query words:
VFoxWin
Keywords : kbcode kbVFp300 kbVFp300b kbVFp600 FxtoolFormdes
Version : 3.00 3.00b
Platform : WINDOWS
Issue type :
|