Article ID: 186084
Article Last Modified on 7/13/2004
aArray - The name of the array. wziRow - Parameter for the row to be deleted from the array.The name of the array and the row to delete are required parameters.
THISFORM._arraylib1.delaitem(@array_name,array_row)
aArray - The name of the array.
sContents - Contents to insert into the array.
iRow - Optional parameter for the row to insert into.
lSetAll - Optional parameter for propagating the contents passed in
sContents to all columns of the newly inserted row of the
array.
The name of the array and the value to insert are required parameters. You
may pass an optional numeric value in the parameter list indicating in
which row to insert the array element. The insaitem method also accepts an
optional logical parameter indicating whether or not the value passed in
sContents is in all row elements of a multi-dimensional array. Calls to the
insaitem method use the following syntax:
THISFORM._arraylib1.insaitem(@array_name,array_element[,[irow], [lsetall]])
CLOSE ALL
SET CLASSLIB TO HOME()+"FFC\_UTILITY.VCX"
outilobject=CREATEOBJECT('array_form')
outilobject.SHOW
READ EVENTS
DEFINE CLASS array_form AS FORM
TOP = 0
LEFT = 0
HEIGHT = 180
WIDTH = 220
DOCREATE = .T.
CAPTION = "_Utilities Demonstration"
NAME = "ARRAY_FORM"
AUTOCENTER=.T.
ADD OBJECT list1 AS LISTBOX WITH ;
HEIGHT = 125, ;
LEFT=05, ;
TOP = 10, ;
WIDTH = 100, ;
ROWSOURCETYPE=5, ;
ROWSOURCE="arraya"
ADD OBJECT list2 AS LISTBOX WITH ;
HEIGHT = 125, ;
LEFT=115, ;
TOP = 10, ;
WIDTH = 100, ;
ROWSOURCETYPE=5, ;
ROWSOURCE="arrayb"
ADD OBJECT command2 AS COMMANDBUTTON WITH ;
LEFT=10, ;
HEIGHT=25, ;
CAPTION="Close Form", ;
TOP=150, ;
WIDTH=200, ;
NAME = "Command2"
ADD OBJECT _arraylib1 AS _arraylib
PROCEDURE LOAD
PUBLIC arraya, arrayb
DECLARE arraya[4]
arraya[1]="Apple"
arraya[2]="Banana"
arraya[3]="Orange"
arraya[4]="Pear"
DECLARE arrayb[4]
arrayb[1]="Blueberry"
arrayb[2]="Cherry"
arrayb[3]="Grapefruit"
arrayb[4]="Strawberry"
ENDPROC
PROCEDURE list1.CLICK
LOCAL thisval
thisval=THISFORM.list1.VALUE
stringval=arraya[thisval]
FOR i=1 TO ALEN(arraya,1)
THISFORM.list1.REMOVEITEM(1)
ENDFOR
THISFORM._arraylib1.insaitem(@arrayb,stringval,thisval-1)
THISFORM._arraylib1.delaitem(@arraya,thisval)
FOR i=1 TO ALEN(arraya,1)
THISFORM.list1.ADDITEM(arraya[i])
NEXT
THISFORM.list2.NUMBEROFELEMENTS=ALEN(arrayb,1)
THISFORM.REFRESH
ENDPROC
PROCEDURE list2.CLICK
LOCAL thisval
thisval=THISFORM.list2.VALUE
FOR i=1 TO ALEN(arrayb,1)
THISFORM.list2.REMOVEITEM(1)
ENDFOR
stringval=arrayb(thisval)
THISFORM._arraylib1.insaitem(@arraya,stringval)
THISFORM._arraylib1.delaitem(@arrayb,thisval)
FOR i=1 TO ALEN(arrayb,1)
THISFORM.list2.ADDITEM(arrayb[i])
NEXT
THISFORM.list1.NUMBEROFELEMENTS=ALEN(arraya,1)
THISFORM.REFRESH
ENDPROC
PROCEDURE command2.CLICK
CLEAR EVENTS
ENDPROC
ENDDEFINEDO ARRAYLIB
THISFORM._arraylib1.insaitem(@arrayb,stringval,thisval-1)
THISFORM._arraylib1.insaitem(@arraya,stringval)
Additional query words: kbCodeSam kbVFp600 FxprgClassoop
Keywords: kbhowto KB186084