B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=12.8
@EndOfDesignText@
Sub Class_Globals
	Private Root As B4XView 'ignore
	Private xui As XUI 'ignore
	Dim q_buscar As String
	Dim c2 As Cursor
	Dim ListView1 As ListView
	Dim lfila As Label
	Private BUSCA As EditText
	Dim STIME As String
	Dim S As Cursor
End Sub

'You can add more parameters here.
Public Sub Initialize As Object
	Return Me
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
	Root = Root1
	'load the layout to Root
	
	Root.LoadLayout("Clientes_completos")
End Sub

Sub BUSCA_TextChanged (Old As String, New As String)
	If New = "" Then 
		ListView1.Clear
	Else 
	q_buscar = "%" & BUSCA.Text & "%"
	c2=B4XPages.MainPage.skmt.ExecQuery2("select  CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from CAT_CATCLIENTESTODOS where (CAT_CL_NOMBRE like ? OR CAT_CL_CODIGO LIKE ? OR CAT_CL_CALLE LIKE ?) order by CAT_CL_NOMBRE ", Array As String(q_buscar,q_buscar,q_buscar))
	ListView1.Clear
	Subs.SetDivider(ListView1, Colors.White, 2)
	lfila.text = "Nombre y Calle"
	If c2.RowCount>0 Then
		For i=0 To c2.RowCount -1
			c2.Position=i
			Dim label1 As Label
			label1 = ListView1.TwoLinesLayout.Label
			label1.TextSize = 20
			label1.TextColor = Colors.White
			Dim label2 As Label
			label2 = ListView1.TwoLinesLayout.SecondLabel
			label2.TextSize = 20
			label2.TextColor = Colors.White
			label1.Height = 25dip
			label2.Height = 60dip
			
			ListView1.TwoLinesLayout.ItemHeight = 95dip
			label1.Typeface = Typeface.CreateNew(Typeface.DEFAULT_BOLD, Typeface.STYLE_BOLD)
			label2.Typeface = Typeface.CreateNew(Typeface.DEFAULT_BOLD, Typeface.STYLE_BOLD)
			ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE")& CRLF &"CALLE:  "& c2.GetString("CAT_CL_CALLE"))
			Next
		End If
'	entro = "4"
		c2.Close
	End If
End Sub


Sub ListView1_ItemClick (Position As Int, Value As Object)
	
		B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
		Log(Value)
		B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
'		DateTime.TimeFormat = "HHmmss"
'		STIME=DateTime.Time(DateTime.Now)
		
		
	B4XPages.ShowPage("Tclientes")

End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.