Wish checkbox

stevel05

Expert
Licensed User
Longtime User
A couple of improvements:

Added a static code module to hold the global variables that store the images, so the are only loaded once and shared by all checkboxes.

Added enabled status, which uses the imageviews Alpha setting to display the disabled state. Get and Setters are not working properly yet for all occurrences in a class, Erel is aware and it will be fixed, so for now, the Enabled Subs are SetEnabled and GetEnabled.
 

Attachments

  • CheckBox2.zip
    17.6 KB · Views: 363
Last edited:
D

Deleted member 103

Guest
@stevel05
I've added a few change.
The box consists now: 1xPanel + 1xImage + 1xLabel.
 

Attachments

  • checkbox_v0.03.zip
    17.7 KB · Views: 355

stevel05

Expert
Licensed User
Longtime User
Nice, the other thing I thought about was passing a panel to the module on which to build the checkbox, that way you could position the panel in the designer, pass it to the checkbox sub and build the checkbox on the panel which would already be in the right position.
 
D

Deleted member 103

Guest
Nice, the other thing I thought about was passing a panel to the module on which to build the checkbox, that way you could position the panel in the designer, pass it to the checkbox sub and build the checkbox on the panel which would already be in the right position.
Yes, that would be a good option.
Would you you go now or should I continue? ;)
 

stevel05

Expert
Licensed User
Longtime User
Please, carry on with it. Make it a community checkbox:)
 
D

Deleted member 103

Guest
Hi,

can someone tell me what is wrong here?
This sub brings a mistake.
Sub Button1_Click
Dim cbxSelect As clsCheckBox
cbxSelect = Panel1.GetView(0)
Log("cbxSelect1.Checked=" & cbxSelect.Checked)
End Sub
 

Attachments

  • Log_checkbox.zip
    17.6 KB · Views: 350

stevel05

Expert
Licensed User
Longtime User
The object returned from Panel1.GetView(0) is a panel, not a clsCheckbox instance, you can store the class instance in the panels tag and access it that way.
 

Attachments

  • lcb.zip
    17.6 KB · Views: 330
D

Deleted member 103

Guest
Yes, this is also a possibility, but then I can not use the Tag property for other objects.
 

klaus

Expert
Licensed User
Longtime User
What exactly do you want to do with this routine?
B4X:
Sub Button1_Click
    Dim cbxSelect As clsCheckBox
    cbxSelect = Panel1.GetView(0)
    Log("cbxSelect1.Checked=" & cbxSelect.Checked)
End Sub

This works:
B4X:
Sub Button1_Click
    Log("cbxSelect1.Checked=" & cbxSelect1.Checked)
End Sub
 
D

Deleted member 103

Guest
Hi Klaus,

the CheckBox is in a panel and the panel is a scrollview.
I need to check if this checkbox is checked or not.
 

stevel05

Expert
Licensed User
Longtime User
You can create a Type structure and store as much as you like in the Tag
 
Top