Sub Globals
Dim SQL1 As SQL
Dim Pnl_MAJ_Cpte As Panel
Dim Bt_Cpt_Ajout, Bt_Cpt_Efface, Bt_Cpt_Sortie As Button
Dim SV_Comptes As ScrollView
Dim TABLE_CPTE As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
SQL1.Initialize( "/mnt/sdcard", "bar.db", True)
Activity.LoadLayout("maj_comptes.bal")
SV_Comptes.Panel.Color=Colors.black
TABLE_CPTE.Initialize("")
TABLE_CPTE.Color = Colors.Green
'--------------------------------------------------------------
Dim CURSOR1 As Cursor
Dim LIST_CPTE As List
Dim TXT_SIZE As Int
Dim LF As Int
LIST_CPTE.Initialize
TXT_SIZE = 20
LF = TXT_SIZE + 10dip
'
CURSOR1 = SQL1.ExecQuery("SELECT nucompte, nomcompte FROM comptes")
SV_Comptes.Panel.Height = CURSOR1.RowCount * LF
SV_Comptes.Panel.AddView( TABLE_CPTE, 10dip, 10dip, SV_Comptes.Width-10, CURSOR1.RowCount * LF )
For i = 0 To CURSOR1.RowCount -1
CURSOR1.Position = i
LIST_CPTE.Clear
LIST_CPTE.Add(CURSOR1.GetInt( "nucompte" ) )
LIST_CPTE.Add(CURSOR1.GetString( "nomcompte" ) )
Dim l As Label
l.Initialize("Cell_Cpte")
l.Gravity = Gravity.CENTER
l.TextSize = TXT_SIZE
l.TextColor = Colors.black
l.Color = Colors.white
l.Tag = i
l.Text = LIST_CPTE.Get(0)
TABLE_CPTE.AddView( l, 5dip, LF * i, 70dip, LF- 2dip)
Dim l As Label
l.Initialize("Cell_Cpte")
l.Gravity = Gravity.CENTER
l.TextSize = TXT_SIZE
l.TextColor = Colors.black
l.Color = Colors.white
l.Tag = i
l.Text = LIST_CPTE.Get(1)
TABLE_CPTE.AddView( l, 72dip, LF * i, SV_Comptes.Width-70dip, LF-2dip)
Next
End Sub
Sub Cell_Cpte_click
Dim rc As RowCol
Dim l As Label
l = Sender
ToastMessageShow(l.text,False)
End Sub