Article ID: 148333
Article Last Modified on 9/30/2003
MODIFY CLASS ? OF C:\Vfp\Samples\Controls\Samples.vcxThen select Moverlist under Classname. Code can be used from the Samples.VCX to create your own mover list box. The code in this article illustrates this.
PUBLIC blist && variable used in the Browse Button
blist=''
USE <tablename>
FOR gnCount = 1 TO FCOUNT( ) && Loop for number of fields
THISform.list1.ADDITEM(Field(gnCount))
NEXT
Thisform.Lockscreen=.T.
nCnt = 1
DO WHILE nCnt <= Thisform.List1.ListCount
IF Thisform.List1.Selected(nCnt)
Thisform.List2.AddItem(Thisform.List1.List(nCnt))
Thisform.List1.RemoveItem(nCnt)
ELSE
nCnt = nCnt + 1
ENDIF
ENDDO
Thisform.Lockscreen=.F.
Thisform.Lockscreen=.T.
nCnt = 1
DO WHILE nCnt <= thisform.list2.ListCount
IF Thisform.List2.Selected(nCnt)
Thisform.List1.AddItem(Thisform.List2.List(nCnt))
Thisform.List2.RemoveItem(nCnt)
ELSE
nCnt = nCnt + 1
ENDIF
ENDDO
Thisform.Lockscreen=.F.
Thisform.Lockscreen=.T.
cnt=Thisform.List1.Listindex
IF Thisform.List1.Selected(cnt) = .T.
nCnt = 1
DO WHILE nCnt <= Thisform.List1.ListCount
IF Thisform.List1.Selected(nCnt)
Thisform.List2.AddItem(Thisform.List1.List(nCnt))
Thisform.List1.RemoveItem(nCnt)
ELSE
nCnt = nCnt + 1
ENDIF
ENDDO
ELSE
=MESSAGEBOX('Please Highlight Your Choice')
ENDIF
Thisform.Lockscreen=.F.
Thisform.LockScreen = .T.
FOR i = 1 to Thisform.List1.ListCount
Thisform.List2.AddItem(Thisform.List1.List(i))
ENDFOR
Thisform.list1.Clear
Thisform.LockScreen = .F.
Thisform.Lockscreen=.T.
cnt=Thisform.List2.Listindex
IF Thisform.List2.Selected(cnt) = .T.
nCnt = 1
DO WHILE nCnt <= Thisform.List2.ListCount
IF Thisform.List2.Selected(nCnt)
Thisform.List1.AddItem(Thisform.List2.List(nCnt))
Thisform.List2.RemoveItem(nCnt)
ELSE
nCnt = nCnt + 1
ENDIF
ENDDO
ELSE
=MESSAGEBOX('Please Highlight Your Choice')
ENDIF
Thisform.Lockscreen=.F.
Thisform.LockScreen = .T.
FOR i = 1 to thisform.list2.ListCount
Thisform.List1.AddItem(Thisform.List2.List(i))
ENDFOR
Thisform.List2.Clear
Thisform.LockScreen = .F.
blist=''
bval=''
Thisform.LockScreen = .T.
FOR x = 1 to Thisform.List2.Listcount
IF x=1
blist=Thisform.List2.List(x)
ELSE
blist=','+Thisform.List2.List(x)
ENDIF
bval=bval+blist
ENDFOR
Thisform.LockScreen = .F.
BROWSE FIELDS &bval
142190 How to Create Mover List Boxes in Visual FoxPro
Additional query words: VFoxWin
Keywords: kbcode KB148333