Android Question enable all buttons

powerino

Active Member
Licensed User
Hello, it is possible to disable all buttons in a Activity...
I made this:

B4X:
Button1.Enabled=False
    Button2.Enabled=False
    Button3.Enabled=False
    Button4.Enabled=False
    Button5.Enabled=False
    Button6.Enabled=False
    Button7.Enabled=False
    Button8.Enabled=False
    Button9.Enabled=False

It is possible with a "for each" or similary?

thanks
 

powerino

Active Member
Licensed User
Thanks a lot. Is it possible to "combine" the name with the numbers (button1, button2) for disable or enable??????
Example:

B4X:
for i=1 to 9
    Button&i.disable=true
next
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could also use an Array of buttons.
Private Buttons() as Button
Buttons = Array As Button (Button1, Button2, Button3, etc>)
Be avare that the Array begins with index 0, therefor Botton(0) is Button1.

The solution is HERE.
 
Last edited:
Upvote 0
Top