Hi all,
I have a list of 41 items, and I need to have specific images load on specific items, not all. I'm at a loss at what to call to make that happen. I'm assuming it's an If Then statement, but I can't figure out how to find the value of each create list item to make that work. Here's my code, and TIA...
I have a list of 41 items, and I need to have specific images load on specific items, not all. I'm at a loss at what to call to make that happen. I'm assuming it's an If Then statement, but I can't figure out how to find the value of each create list item to make that work. Here's my code, and TIA...
B4X:
Sub Show
pg.Initialize("pg")
pg.RootPanel.LoadLayout("lists")
Main.NavControl.ShowPage(pg)
clv1.Initialize(Me, "clv1", 100%x)
pg.RootPanel.AddView(clv1.AsView, 0, 0, 100%x, 100%y)
clv1.DefaultTextColor = Colors.white
pg.RootPanel.Color = Colors.Black
pg.Title = "Panel Options"
clv1.Add(CreateListItem("1.1. Dial tone check", clv1.AsView.Width, 45dip), 45dip, 1)
clv1.Add(CreateListItem("1.2. Pulse dialling", clv1.AsView.Width, 45dip), 45dip, 2)
clv1.Add(CreateListItem("1.3. DTMF withoutCode", clv1.AsView.Width, 45dip), 45dip, 3)
clv1.Add(CreateListItem("1.4. Line down signal", clv1.AsView.Width, 45dip), 45dip, 4)
clv1.Add(CreateListItem("1.5. Double call", clv1.AsView.Width, 45dip), 45dip, 5)
clv1.Add(CreateListItem("1.6. Call all VOXNums", clv1.AsView.Width, 45dip), 45dip, 6)
clv1.Add(CreateListItem("1.7. Call all TLVNums", clv1.AsView.Width, 45dip), 45dip, 7)
clv1.Add(CreateListItem("1.8. RefreshMnstblOut", clv1.AsView.Width, 45dip), 45dip, 8)
clv1.Add(CreateListItem("1.9. Num15ForTeleserv", clv1.AsView.Width, 45dip), 45dip, 9)
clv1.Add(CreateListItem("1.10. Install.callback", clv1.AsView.Width, 45dip), 45dip, 10)
clv1.Add(CreateListItem("1.11. ReaderBuzzer OFF", clv1.AsView.Width, 45dip), 45dip, 11)
clv1.Add(CreateListItem("1.12. Keypad lockout", clv1.AsView.Width, 45dip), 45dip, 12)
clv1.Add(CreateListItem("1.13. View open zones", clv1.AsView.Width, 45dip), 45dip, 13)
clv1.Add(CreateListItem("1.14. OpenZonesArmLock", clv1.AsView.Width, 45dip), 45dip, 14)
clv1.Add(CreateListItem("1.15. DTMF sentitivity", clv1.AsView.Width, 45dip), 45dip, 15)
clv1.Add(CreateListItem("1.16. BypassAlsoTamper", clv1.AsView.Width, 45dip), 45dip, 16)
clv1.Add(CreateListItem("1.17. BypassVoiceCheck", clv1.AsView.Width, 45dip), 45dip, 17)
clv1.Add(CreateListItem("1.18. Conrm with *", clv1.AsView.Width, 45dip), 45dip, 18)
clv1.Add(CreateListItem("1.19. NoUserTamp.reset", clv1.AsView.Width, 45dip), 45dip, 19)
clv1.Add(CreateListItem("1.20. Data encryption", clv1.AsView.Width, 45dip), 45dip, 20)
clv1.Add(CreateListItem("1.21. Instant restoral", clv1.AsView.Width, 45dip), 45dip, 21)
clv1.Add(CreateListItem("1.22. Teleserv.hidden", clv1.AsView.Width, 45dip), 45dip, 22)
clv1.Add(CreateListItem("1.23. LockInstall.Code", clv1.AsView.Width, 45dip), 45dip, 23)
clv1.Add(CreateListItem("1.24. 50131ReadLedOFF", clv1.AsView.Width, 45dip), 45dip, 24)
clv1.Add(CreateListItem("1.25. 50131StatHidden", clv1.AsView.Width, 45dip), 45dip, 25)
clv1.Add(CreateListItem("1.26. 50131IconsHidden", clv1.AsView.Width, 45dip), 45dip, 26)
clv1.Add(CreateListItem("1.27. 50131AlarDelayed", clv1.AsView.Width, 45dip), 45dip, 27)
clv1.Add(CreateListItem("1.28. 50131WarnLedMem", clv1.AsView.Width, 45dip), 45dip, 28)
clv1.Add(CreateListItem("1.29. DayLightSav.time", clv1.AsView.Width, 45dip), 45dip, 29)
clv1.Add(CreateListItem("1.30. NoStringsSiaProt", clv1.AsView.Width, 45dip), 45dip, 30)
clv1.Add(CreateListItem("1.31. AllSiaIPOnPerEv", clv1.AsView.Width, 45dip), 45dip, 31)
clv1.Add(CreateListItem("1.32. CONT-IDInversion", clv1.AsView.Width, 45dip), 45dip, 32)
clv1.Add(CreateListItem("1.33. Dust event enab.", clv1.AsView.Width, 45dip), 45dip, 33)
clv1.Add(CreateListItem("1.34. Maintenance", clv1.AsView.Width, 45dip), 45dip, 34)
clv1.Add(CreateListItem("1.35. Show scenario", clv1.AsView.Width, 45dip), 45dip, 35)
clv1.Add(CreateListItem("1.36. Tamper siren", clv1.AsView.Width, 45dip), 45dip, 36)
clv1.Add(CreateListItem("1.37. Squawk on arming", clv1.AsView.Width, 45dip), 45dip, 37)
clv1.Add(CreateListItem("1.38. Future use", clv1.AsView.Width, 45dip), 45dip, 38)
clv1.Add(CreateListItem("1.39. 50131 grade 3", clv1.AsView.Width, 45dip), 45dip, 39)
clv1.Add(CreateListItem("1.40. Alarm on keypads", clv1.AsView.Width, 45dip), 45dip, 40)
clv1.Add(CreateListItem("1.41. SingleCallEachEv", clv1.AsView.Width, 45dip), 45dip, 41)
End Sub
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
Dim b As Button
b.Initialize("button", b.STYLE_SYSTEM) 'all buttons click events will be handled with Sub Button_Click
Dim lbl As Label
lbl.Initialize("lbl")
lbl.TextAlignment = lbl.ALIGNMENT_LEFT
lbl.Text = Text
lbl.TextColor = Colors.White
lbl.Font = Font.CreateNew(16)
p.AddView(lbl, 5dip, 2dip, 200dip, Height - 4dip) 'view #0
Dim picture As ImageView
picture.Initialize("Disabled1.png")
picture.Bitmap = LoadBitmap(File.DirAssets, "Disabled1.png")
p.AddView(picture, 80%x,8dip, 30dip, Height - 15dip) 'view #2
Return p
If Text = "1.4. Line down signal" Then
Dim picture As ImageView
picture.Initialize("VideoEnabled.png")
picture.Bitmap = LoadBitmap(File.DirAssets, "VideoEnabled.png")
p.AddView(picture, 80%x,8dip, 30dip, Height - 15dip) 'view #2
Return p
End If
End Sub