what do you think is the best technique to vinculate a special data type into a combo?
thats is. Sample:
. in a combo a put a name of customer, but i need all fields about cuscomer: name, code, tax, phone, etc.
when the user select a custome in combo (by name), i need return all data.
Now, i vincule a LIST, with maps with equal id to selectedindex. When the user select a item, i read in a public (or local), list with the selectedindex, and read the INDEX of map into the list.
That is not very easy to use and understand.
any good idea:
This is my actual code:
and in combo select;
note this code are not operative with other code.
thats is. Sample:
. in a combo a put a name of customer, but i need all fields about cuscomer: name, code, tax, phone, etc.
when the user select a custome in combo (by name), i need return all data.
Now, i vincule a LIST, with maps with equal id to selectedindex. When the user select a item, i read in a public (or local), list with the selectedindex, and read the INDEX of map into the list.
That is not very easy to use and understand.
any good idea:
This is my actual code:
B4X:
Sub CargarComboPlus3(ComboPlusLocal As B4XComboBox, Sql As String , CampoEnCombo As String, ValorActual As String ,ListaEnMemoriaDeMapas As List ,TituloELEMENTOUno As String )
Try
If TituloELEMENTOUno = "" Then
TituloELEMENTOUno = VALORTITULOCOMBO
End If
Dim JD As JdbcResultSet
Dim Txt As String
Dim Mapa As Map
Dim ExisteValorActual As Boolean
ExisteValorActual = False
If ListaEnMemoriaDeMapas.IsInitialized = False Then
JD = GetRecordSet(Sql,True)
CloneRsToMAP(JD,ListaEnMemoriaDeMapas)
End If
Dim F As Int
ComboPlusLocal.cmbBox.Clear
ComboPlusLocal.cmbBox.Add(TituloELEMENTOUno)
ComboPlusLocal.SelectedIndex = 0
For f = 0 To ListaEnMemoriaDeMapas.Size - 1
Dim Mapa As Map
Mapa = ListaEnMemoriaDeMapas.Get(f)
Txt = Mapa.Get(CampoEnCombo)
ComboPlusLocal.cmbBox.Add(Txt)
If ValorActual = Txt Then
ComboPlusLocal.cmbBox.SelectedIndex = ComboPlusLocal.cmbBox.Size -1
ExisteValorActual = True
End If
'Loop
Next
Catch
Log(LastException)
End Try
End Sub
and in combo select;
B4X:
Private Sub B4XTipoMedida_SelectedIndexChanged (Index As Int)
Dim Mapa As Map
Dim InputType As String
Try
Mapa =LTiposMedidas.Get(Index-1)
B4XTipoUnidades.Text = Mapa.Get("Medida")
InputType = Mapa.Get("InputType")
Dim IT As EditText
IT = B4XValorMedido.TextField
Select Case InputType
Case "TXT"
IT.InputType= IT.INPUT_TYPE_TEXT
Case "INT"
IT.InputType= IT.INPUT_TYPE_NUMBERS
Case "DOU"
IT.InputType= IT.INPUT_TYPE_DECIMAL_NUMBERS
Case Else
IT.InputType= IT.INPUT_TYPE_TEXT
End Select
Catch
Log(LastException)
End Try
End Sub
note this code are not operative with other code.
Last edited: