Hello;
I used your costumview code. and I added 1label + 2spinner +1 checkbox in every panel.
So, I cant detecet /divide spinner1 or spinner2. And I want works spinner click each one.
How can I?
I used your costumview code. and I added 1label + 2spinner +1 checkbox in every panel.
So, I cant detecet /divide spinner1 or spinner2. And I want works spinner click each one.
How can I?
B4X:
Sub Button1_Click
' scrool vieww için hazırlanmış
' https://www.b4x.com/android/forum/threads/class-customlistview-a-flexible-list-based-on-scrollview.19567/#content
'https://www.b4x.com/android/forum/threads/scrollview-examples-summary.8423/#content
ProgressDialogShow("Rehberiniz okunuyor ve listeleniyor...")
Dim xcall As PhoneCalls
Dim xsms As PhoneSms
'xsms.Send("+905335135121","2 sistemm çalıstı")
'StartActivity( xcall.Call("02127711379"))
Dim c As Contact
Dim cs As Contacts2
'-------------Liste düzenleme-------------------
clv3.Initialize(Me, "clv3")
Activity.AddView(clv3.AsView, 0, 30%y, 100%x, 70%y)
Dim phonelist As List
phonelist.Initialize
'----------------------------------
Dim l As List
l = cs.GetAll(True,True)
Dim telf As Map
'Msgbox(l.Size, "kişi sayısı")
For i = 0 To l.Size - 1
c = l.Get(i)
telf= c.GetPhones
Log(c.DisplayName)
'phonelist.AddAll(telf.Keys)
phonelist.Clear
For z=0 To telf.size-1
phonelist.Add(telf.GetKeyAt(z))
'Log(z&". numara : " & telf.GetValueAt(z))
Next
'clv3.Add(CreateListItem2(c.DisplayName, clv3.AsView.Width, 80dip,phonelist), 80dip, "Item #" & i)
clv3.Add(CreateListItem2(c.DisplayName, clv3.AsView.Width, 80dip,phonelist), 80dip, c.Id)
Next
ProgressDialogHide
End Sub
B4X:
'---- never run
Sub spn2_ItemClick (Position As Int, Value As Object)
Msgbox("2 ci","")
End Sub
'always run it
Sub spn_ItemClick (Position As Int, Value As Object)
Dim index As Int
index = clv3.GetItemFromView(Sender)
Dim pnl As Panel
pnl = clv3.GetPanel(index)
Dim spn,spn2 As Spinner
Dim lbl As Label
Dim chk As CheckBox
lbl = pnl.GetView(1)
spn = pnl.GetView(2)
chk = pnl.GetView(0)
spn2 = pnl.GetView(3)
lbl.Text = "telfon!"
Msgbox("Item value: " & clv3.GetValue(index) & CRLF & "spinner value: " & spn.GetItem(Position), "")
End Sub
B4X:
Sub CreateListItem2(Text As String, Width As Int, Height As Int, phonelist As List) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
Dim b As Button
b.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
Dim chk As CheckBox
chk.Initialize("chk")
Dim lbl As Label
lbl.Initialize("")
Dim spn As Spinner
Dim spn2 As Spinner
spn.Initialize("spn")
spn2.Initialize("spn")
spn.AddAll(phonelist)
spn2.AddAll(Array As String("Bey","Hanım","Amcacağım","Dayıcığım","Halacığım","Teyzeciğim", "Yengeciğim","Dedeciğim","Nineciğim","Ablacağım","Abiciğim","Kardeşim","Kuzenim","Yeğenim","babananeciğim", "anneanneciğim"))
lbl.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
lbl.Text = Text
lbl.TextSize = 16
lbl.TextColor = Colors.White
b.Text = "Click"
'p.AddView( l - T w- h
p.AddView(chk, 5dip, 2dip, 50dip, Height - 4dip) 'view #0
p.AddView(lbl, 55dip, 2dip, 165dip, Height - 4dip) 'view #1
p.AddView(spn, 220dip, 2dip, 170dip, Height - 4dip) 'view #2
p.AddView(spn2, 390dip, 2dip, 150dip, Height - 4dip) 'view #3
Return p
End Sub