Android Question ClsCheckList: CallSub3 is not working

demasi

Active Member
Licensed User
Hello,
I'm trying to use the ClsCheckList class in a project but I'm facing a problem.
At line 1148 of the class, the SubExists is returning FALSE and the CallSub3 at line 1150 is not executing.
Even if I exclude the SubExists and call directly it can't find the call back routine.
I tried in 2 android phones, sony z3 and samsung note 4, both with android 5.1.1 and the same result.
The callback routine is at the Main module, lstClick, as refered in the lst.initialize.
The lstClick sub is never executed.
Project is attached as zip.
Thanks for any help.

B4X:
Private Sub pnlSV_Click(ViewTag As Object) As Boolean
    Dim pnl As Panel
    pnl = Sender
    Msgbox(CallbackMod & " - " & sub_Click,SubExists(CallbackMod, sub_Click)) 
    If SubExists(CallbackMod, sub_Click) Then
        Msgbox("True","") 
        CallSub3(CallbackMod, sub_Click, pnl, pnl.Tag)
    End If
    Return True
End Sub

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim sv As ScrollView
    Dim lst As ClsCheckList 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    sv.Initialize(1000)
    lst.Initialize(Me,sv,"lstCheck","lstClick","lstLongClick",1)
    lst.DividerColor = Colors.Black 
    Activity.AddView(sv,0,0,100%x,100%y)
    For i=1 To 10
        lst.AddItemNoChkbx(0,"Test ",i,Null)
    Next
    lst.ResizePanel
End Sub

Sub lstClick
    Msgbox("Click","")
End Sub
 

Attachments

  • Project.zip
    15.9 KB · Views: 113

demasi

Active Member
Licensed User
I think I've found the solution.
the names of the subs must have the name of the object (lst) and an underscore before the name of the callback sub.
I changed the names to lst_click in the sub and in the initialize method and now it works.
I really don't know why, but thats it!
Thank you all.
 
Upvote 0
Top