Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Super Mover Class usage

Status
Not open for further replies.

crewchiefpro6

Programmer
Mar 22, 2005
204
US
I have never needed a mover class before until now and I am experimenting with the Super Mover class in vfp. My question is how do I add a dbf as a control source properly, and how do I include the moved items into my select sql command.

Currently I have the left listbox as rowsource of a cursor created in Load, this displays the information properly but when one item is selected it does not remove this item after transferring over.

After I move all the items I need how do I add these to the select sql statement as part of a where clause?

Sorry for the simplistic question but I cannot find good info in the help file on this.


Don Higgins
 
Hi,
Probably, what you are looking for is in the 'InitChoices' and 'InitSelections' methods of the _mover class.

Code:
Dimension aChoices[AvailableNumberOfSelections,1]
Dimension Chosen[AvailableNumberOfSelections,1]

Select srcTable
Scan
   * Populate aChoices array from the source table
endscan

* Call the 'selector' form
Code:
do form frmSelector with aChoices to Chosen


*In the 'OK' click of 'frmSelector' form
Code:
Local i, aSelections
Dimension aSelections[1]
aSelections = ""
Thisform._SuperMover1.GetSelections(@aSelections)
For i = 1 to alen(aSelections)
   Chosen[m.i] = aSelections[m.i]
endfor

When the control shifts back to the calling form, the array Chosen will (i hope) hold the selections.
Whilst testing the above, I did have some issues with the 'Chosen' array and had created a listbox (ChosenList) in the 'CallingForm'.
This listbox, I populated in the 'OK' click of 'FrmSelector' as...

Code:
Local i, aSelections
Dimension aSelections[1]
aSelections = ""
Thisform._SuperMover1.GetSelections(@aSelections)
For i = 1 to alen(aSelections)
   Chosen[m.i] = aSelections[m.i]
   [blue]CallingForm.chosenlist.AddItem(aSelections[m.i]) [/blue]
endfor

Rajesh
 
[After I move all the items I need how do I add these to the select sql statement as part of a where clause?
You would loop through the listed items adding each item to a list, then use INLIST(), IN, $ or whatever to do the compare:
Code:
STORE '' TO cTemp
FOR zzz = 1 TO CallingForm.chosenlist.ListCount
   cTemp = '"' + ;
      Alltrim(CallingForm.chosenlist.listitem(zzz)) + ;
      '",'
NEXT

cTemp = Left(cTemp, LEN(cTemp) -1)  &&... get rid of last ","

Now you have a variable called cTemp with you can use for a comparison using something like:
Code:
SELECT * FROM whatever ;
   WHERE somefield $ cTemp
-or-
Code:
STORE "INLIST(somefield, " + cTemp + ")" TO cCriteria
SELECT * FROM whatever ;
   WHERE &cCriteria

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top