how to show a modal selector in b4x (java and android) .
A simple list with 2 or more opcion
i doing the below code, but the first error for me is how set Mainform in b4x
i change to public a variable in main:
and put
instead
Main_O_WHATtoPut
but i think this is not the best solution
A simple list with 2 or more opcion
i doing the below code, but the first error for me is how set Mainform in b4x
B4X:
Dim r As List
dim Linea1 as string, linea2 as string
Dim m As Int
r.Initialize
Linea1= "opcion1"
Linea2= "opcion 2"
r.AddAll(Array As String(Linea1, Linea2))
#if b4j
Dim fx As JFX 'is necessare referenci jfx library'
m = fx.InputList(Main_O_WHATtoPut, r, "Seleccione ", "Productos", 0) 'me vs MainForm
If m >= 0 Then
'Log($"Selected item: ${items.Get(m)}"$)
Else
'Log("User didn't select any item.")
End If
#else 'b4a'
Dim x As id 'need reference id libreary'
m = x.InputList1(r, "Opciones")
#end if
Select Case m
Case 0 '
'correcta la primera
Case 1 '
'lo segundo'
Case Else
End Select
End If
..
i change to public a variable in main:
B4X:
Sub Process_Globals
Private fx As JFX
Public MainForm As Form
End Sub
and put
B4X:
m = fx.InputList(Main.MainForm , r, "Seleccione el producto", "Productos", 0) 'me vs MainForm
instead
Main_O_WHATtoPut
but i think this is not the best solution
Last edited: