this is my code, the msgbox doesn't appear....
tried to remove and insert again the listview, the event is created from object designer...
why????
tried to remove and insert again the listview, the event is created from object designer...
why????
B4X:
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim SQL1 As SQL :SQL1 = Main.SQL1
Private SpScuola As Spinner
Private SpClasse As Spinner
Private SpSezione As Spinner
Private LstAlunni As ListView
Dim bmpGrn As Bitmap
Dim bmpRed As Bitmap
' Private PnlDett As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("rilevazione")
'devo riempire lo spinner scuole
SpScuola.Add(" ")
Dim Cur As Cursor
Cur = SQL1.ExecQuery("SELECT distinct DesScuola FROM Anagrafiche order by Scuola")
For i = 0 To Cur.RowCount-1
Cur.Position = i
SpScuola.Add(Cur.GetString("DesScuola"))
Next
Cur.Close
SpScuola.SelectedIndex=0
' PnlDett.Visible = False
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub SpScuola_ItemClick (Position As Int, Value As Object)
'devo riempire lo spinner classi
SpClasse.Clear
SpSezione.Clear
LstAlunni.Clear
SpClasse.Add(" ")
Dim Cur As Cursor
Cur = SQL1.ExecQuery("SELECT distinct Classe FROM Anagrafiche where DesScuola='"&SpScuola.SelectedItem&"' order by Classe")
For i = 0 To Cur.RowCount-1
Cur.Position = i
SpClasse.Add(Cur.GetString("Classe"))
Next
Cur.Close
SpClasse.SelectedIndex=0
End Sub
Sub SpClasse_ItemClick (Position As Int, Value As Object)
'devo riempire lo spinner sezioni
SpSezione.Clear
LstAlunni.Clear
SpSezione.Add(" ")
Dim Cur As Cursor
Cur = SQL1.ExecQuery("SELECT distinct Sezione FROM Anagrafiche where DesScuola='"&SpScuola.SelectedItem&"' and Classe='"&SpClasse.SelectedItem&"' order by Sezione")
For i = 0 To Cur.RowCount-1
Cur.Position = i
SpSezione.Add(Cur.GetString("Sezione"))
Next
Cur.Close
SpSezione.SelectedIndex=0
End Sub
Sub SpSezione_ItemClick (Position As Int, Value As Object)
'facciamo vedere gli alunni di questa classe e sezione
bmpGrn.Initialize(File.DirAssets, "Circle_Green.png")
bmpRed.Initialize(File.DirAssets, "Circle_Red.png")
LstAlunni.Initialize("ListView1")
LstAlunni.TwoLinesAndBitmap.ItemHeight = 55dip
LstAlunni.TwoLinesAndBitmap.Label.TextSize = 15
LstAlunni.TwoLinesAndBitmap.Label.TextColor = Colors.Black
LstAlunni.FastScrollEnabled = True
LstAlunni.Color = Colors.White
LstAlunni.ScrollingBackgroundColor = Colors.White
Activity.Color = Colors.White
PopolaLista
End Sub
Sub PopolaLista
LstAlunni.Clear
' PnlDett.Visible = False
Dim cur As Cursor
cur = SQL1.ExecQuery("SELECT Studente, CogStudente, NomStudente, Bianco, Status, Note FROM Anagrafiche where DesScuola='"&SpScuola.SelectedItem&"' and Classe='"&SpClasse.SelectedItem&"' and Sezione='"&SpSezione.SelectedItem&"' order by CogStudente")
For i = 0 To cur.RowCount-1
cur.Position = i
If cur.GetString("Status")="P" Then
LstAlunni.AddTwoLinesAndBitmap(cur.GetString("Studente")&" "&cur.GetString("CogStudente")&" "&cur.GetString("NomStudente"),cur.GetString("Bianco")&" "&cur.GetString("Note"),bmpGrn)
Else
LstAlunni.AddTwoLinesAndBitmap(cur.GetString("Studente")&" "&cur.GetString("CogStudente")&" "&cur.GetString("NomStudente"),cur.GetString("Bianco")&" "&cur.GetString("Note"),bmpRed)
End If
Next
Activity.AddView(LstAlunni, 10, 320, 100%x, 75%y)
End Sub
Sub LstAlunni_ItemClick (Position As Int, Value As Object)
Msgbox("ciao","")
End Sub