Prior to 320, this worked fine.
Now I get - Container No component found with id x2
Now I get - Container No component found with id x2
B4X:
Sub btnpids_Clicked(Target As String)
Dim pidbox As ABMModalSheet = page.ModalSheet("pidbox")
Dim j As Int = 1
Dim k As Int = 2
Log("what is selected selpid: "&selpid)
For i = 0 To pidmap.Size -1
Dim id,disp As Int
id = pidmap.GetKeyat(i)
Dim user As Map
user.Initialize
user = pidmap.GetValueat( i )
Dim nam As String
Dim switch1 As ABMSwitch
nam = user.Getkeyat(0)
If selpid.ContainsKey(""&id) Then
disp = 1
Else
disp = 0
End If
If (disp = 0) Then
switch1.Initialize(page, "x"&id , nam, "", False, "")
Else
switch1.Initialize(page, "x"&id , nam, "", True, "")
End If
switch1.Tag = disp
pidbox.Content.Cell(k,j).RemoveAllComponents
pidbox.Content.Cell(k,j).AddArrayComponent( switch1, "pid")
Log(" Building pids: x"&id) ' shows the correct ID that was added to array
j = j + 1
If j = 4 Then
k = k + 1
j = 1
End If
Next
page.ShowModalSheet("pidbox")
End Sub
Sub pid_Clicked(Target As String)
Log(" what is target: "&Target) ' shows full target
Dim pidbox As ABMModalSheet = page.ModalSheet("pidbox")
Dim p As String
Dim sz As Int = selpid.Size
p = Target.Replace( "pidbox-content-pid","") ' strip junk from target to get the ID
Dim switch1 As ABMSwitch = pidbox.Content.Component( p)
Log("what is before component: "&p&" id: "&switch1.ID&" tag: "&switch1.Tag )
' blows up cause it can't find the ID of switch1
' Now I get - Container No component found with id x2
Log("what is before selpid: "&selpid)
If (selpid.Size = 4) Then
' Toast(" Only Four PIDs Allowed! ",5000)
switch1.Tag = 1
End If
If switch1.Tag = 1 Then
switch1.State = False
'switch1.Image = "../images/ostar.png"
switch1.Tag = 0
Else
switch1.State = True
'switch1.Image = "../images/star.png"
switch1.Tag = 1
End If
switch1.Refresh
If switch1.Tag = 1 Then
selpid.Put(p,1)
Else
selpid.Remove(p)
End If
If (sz = 4) And (selpid.Size = 4 ) Then
Toast(" Only Four PIDs Allowed! ",5000)
' switch1.Tag = 1
End If
Log("what is component: "&p&" id: "&switch1.ID&" tag: "&switch1.Tag )
Log("what is selpid: "&selpid)
End Sub