Wish checkbox

Filippo

Expert
Licensed User
Hi stevel05,

Thank you very much! :)
 

stevel05

Expert
Licensed 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

Last edited:

Filippo

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

Attachments

stevel05

Expert
Licensed 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.
 

Filippo

Expert
Licensed 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.
Yes, that would be a good option.
Would you you go now or should I continue? ;)
 

stevel05

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

Filippo

Expert
Licensed User
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

stevel05

Expert
Licensed 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

Filippo

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

klaus

Expert
Licensed 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
 

Filippo

Expert
Licensed User
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
You can create a Type structure and store as much as you like in the Tag
 
Top