iOS Question Class sometimes not fire events

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi all! I've an application that has some class (checkbox and spinner). Sometimes, the event will not be fired when i tap on spinner or checkbox. I reuse the same code when i add view, and sometimes works, sometimes no. Anyone know what is the problem?

I've the view in different modules
B4X:
For i = 0 To MultiChoiseList.Size-1
            Dim chk As CheckBox
            chk.Initialize("checkbox",Me)
            chk.SetCallbackModule(Me) 'Tried with and without this. Same thing
            scv.Panel.AddView(chk.View,0,i*42dip,dialogWidth-64dip,40dip)
            chk.TextAlignment = 0
            chk.TextColor = 0xffffffff
            chk.TextSize = 14
            chk.UpdateLayout
            chk.Text = MultiChoiseList.Get(i)
            chk.Label.Multiline = True
            chk.Tag = i
            If SelectedList <> Null And SelectedList.IndexOf(i) <> -1 Then
                chk.Checked = True
                SelectedText.Add(chk.Text)
            End If
        Next

'Class module
Sub Sw_ValueChanged(checked As Boolean) 'This not fire
    If SubExists(CallBack, mEventName & "_CheckedChange", 1) Then
        CallSub2(CallBack, mEventName & "_CheckedChange", sw.Value)
    Else
        Log ("Checkbox callback '" & mEventName & "_CheckedChange" & "' with one parameter not found.")
    End If
End Sub

Public Sub Initialize(EventName As String, cb As Object)

    mEventName = EventName
    CallBack   = cb

    pnl.Initialize("")   
    sw.Initialize("Sw")  'Initialize <--- sometimes works

    lbl.Initialize("")
    lbl.TextAlignment = lbl.ALIGNMENT_LEFT
   
    isEnabled    = True
    parentPnlSet = False
End Sub
 
Top