clsCheckList Usage

ClassicDancer

Member
Licensed User
Longtime User
Hi,

I'm using the clsCheckList class. I've setup a custom based list with a check box included. I've setup the check box as in the demo version i.e. cbx.Initialize("customChBx") and the event as follows:

Sub customChBx_CheckedChange(Checked As Boolean)

Activity.Title = SaveTitle & lst.CheckedList.Size & " item(s) checked"

End Sub

My problem is how do i in code identify which check box has been pressed. I want to update my database behind the scenes to reflect the check box state.

Please help.....

Regards,

Andy
 

Informatix

Expert
Licensed User
Longtime User
Hi,

I'm using the clsCheckList class. I've setup a custom based list with a check box included. I've setup the check box as in the demo version i.e. cbx.Initialize("customChBx") and the event as follows:

Sub customChBx_CheckedChange(Checked As Boolean)

Activity.Title = SaveTitle & lst.CheckedList.Size & " item(s) checked"

End Sub

My problem is how do i in code identify which check box has been pressed. I want to update my database behind the scenes to reflect the check box state.

You should post in the class thread because I read this thread very randomly.

The demo #1 is an answer to your question. Look at how the checkboxes are handled. The view and the ID of each clicked checkbox is sent back by the class.

A handler for the checkbox events must be defined this way:
B4X:
Sub myChkBx_CheckedChange(chb As CheckBox, ID As Object)
End Sub

And don't forget to set this sub name in the Initialize function.
 
Upvote 0

ClassicDancer

Member
Licensed User
Longtime User
Hi,

Thanks for your reply. In the future I'll post in the correct thread. Sorry I'm new to this forum.

I've looked at the demo program, however the Sub lst_CheckedChange(chb As CheckBox, ID As Int) event doesn't get fired when I add a ADDCustomItem(i,pnl,40dip) with a check box included within the panel. The only event being fired is the Sub customChBx_CheckedChange(Checked As Boolean) which does have a reference to the check box selected. This event has been added to the cbx.Initialize("customChBx").

Am I missing something here.....

Thanks Andy
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I've looked at the demo program, however the Sub lst_CheckedChange(chb As CheckBox, ID As Int) event doesn't get fired when I add a ADDCustomItem(i,pnl,40dip) with a check box included within the panel.

I released a new version because there was an improper declaration in the demo #1 for lst_CheckedChange, but that worked before.
The problem here is that you use a custom item. In this case, your checkbox is not created by the class but by your own code in the activity module. So get the event for your checkbox as you would do for any checkbox.
If you set MyCheckBox("toto"), then you'll get the event with:
toto_CheckedChange(Checked As Boolean)

Look at Sub btnCustomLayout_Click and Sub customChBx_CheckedChange in the demo #1.
 
Upvote 0

ClassicDancer

Member
Licensed User
Longtime User
Thanks for your reply.

Since my last post I've found the answer. I used the sender keyword in order to obtain the checkbox properties.

Regards,

Andy
 
Upvote 0
Top