I need a way to store a list of dynamically created textboxes or data pickers.
cmdSave_click is crashing.
Do I need to initialize my array of textfields and pickers if the controls I am storing are initialized?
B4X:
Dim arrPicker(100) As Picker
Dim iPickerCounter As Int
iPickerCounter=0
arrPicker(iPickerCounter).Initialize("lbx" & iPickerCounter)
arrPicker(iPickerCounter).Tag=sTestId
Dim myList As List
myList.Initialize
oKeyValue.Initialize(sListText,oFont, Colors.Black)
oKeyValue.Tag=sListValue
myList.Add(oKeyValue)
arrPicker(iPickerCounter).SetItems(0,myList)
arrPicker(iPickerCounter).SelectRow(0,FindByValueWithAttributeString(arrPicker(iPickerCounter),0,sSelectedValue),True)
'Added the new control to the control array
If iPickerCounter<5 Then
arrPicker(iPickerCounter)=oLBX
iPickerCounter=iPickerCounter + 1
End If
ScrollViewInput.Panel.AddView(arrPicker(iPickerCounter),300dip,iRowOffset-(arrPicker(iPickerCounter).Height/2),50%x,500dip)
iRowOffset=iRowOffset+(arrPicker(iPickerCounter).Height)+100
If iPickerCounter<100 Then
listControls.InsertAt(iPickerCounter,arrPicker(iPickerCounter))
iPickerCounter=iPickerCounter + 1
End If
Sub cmdSave_Click
Dim i As Int
For i =0 To listControls.Size-1
Dim attr As AttributedString =arrPicker(i).GetItems(0).Get(i)
Msgbox(arrPicker(i).Tag & "=" & attr.tag,"save_click")
Next
end Sub
cmdSave_click is crashing.
Do I need to initialize my array of textfields and pickers if the controls I am storing are initialized?
Last edited: