Hi
I created eight checkboxes.
I would not like to write very similar code in each checkboxes
I would like to use something like this:
and use the following code for each checkboxes
Regards
Artur
I created eight checkboxes.
B4X:
Dim b as Byte
Sub CheckBox1_CheckedChange(Checked As Boolean)
If CheckBox1.Checked = True Then Bit.And(b, 1)
else Bit.Or(b, 1)
endif
End Sub
Sub CheckBox2_CheckedChange(Checked As Boolean)
If CheckBox2.Checked = True Then Bit.And(b,2)
else Bit.Or(b, 2)
endif
End Sub
Sub CheckBox3_CheckedChange(Checked As Boolean)
...
End Sub
Sub CheckBox4_CheckedChange(Checked As Boolean)
...
End Sub
Sub CheckBox5_CheckedChange(Checked As Boolean)
...
End Sub
Sub CheckBox6_CheckedChange(Checked As Boolean)
...
End Sub
Sub CheckBox7_CheckedChange(Checked As Boolean)
...
End Sub
...
Sub CheckBox8_CheckedChange(Checked As Boolean)
I would not like to write very similar code in each checkboxes
I would like to use something like this:
B4X:
Sub Check_Checkboxes (number As Int)
If CheckBox[number].Checked = True Then Bit.And(b, number)
else Bit.Or(b, number)
End Sub
and use the following code for each checkboxes
B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
Check_Checkboxes(1)
endif
Regards
Artur