Enable label

fanfalveto

Active Member
Licensed User
Longtime User
Good afternoon. I have about twenty labels in an activity, how I can enable or disable all at once. One by one the code is eternal. thanks
 

klaus

Expert
Licensed User
Longtime User
You can't do it at once.

What you can do is either:
- define an array of Labels and enable / disable them in a loop
- put all Labels on a Panel and set Visible True / False, but this is not exactly what you are asking for.

Best regards.
 
Upvote 0

gulliver

Member
Licensed User
Longtime User
Good afternoon. I have about twenty labels in an activity, how I can enable or disable all at once. One by one the code is eternal. thanks
Have you tried:
B4X:
For Each v As View In Activity
 If v Is Label Then v.enabled = false
Next
 
Upvote 0

fanfalveto

Active Member
Licensed User
Longtime User
Thank you very much,I saved a lot of code. I've done this:
B4X:
For Each v As View In Activity
 If v Is Label Then
 v.enabled = True 
 v.Visible=True
 End If
 Next
All labels enbled and visible in 6 lines.
Thanks
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
For Each v As View In Activity
If v Is Label Then v.enabled = false
Next
I do not think the above will work because edittext views are also considered label. Therefore, they will also be disabled, unless of course you do not have edittext in tyour panel or activity. Perhaps, you can stick something in the tag.
 
Upvote 0

fanfalveto

Active Member
Licensed User
Longtime User
This solution is good for me because i disabled the labels one by one, when everyone is disabled i need enabled them all at once, I have a EditText but with this solution is not affected.
Also i try the array and panel.
Thanks
 
Upvote 0
Top