moore_it Well-Known Member Licensed User Longtime User Nov 17, 2014 #1 Hello again, i've named a list of buttons like "btn" when i mouseclicked one of them, i solve what btn clicked via .text attribute. When i try to disable buttons "btn.disable = true" it's disable only clicked button. It's true ? Or not ? If i need to disable or enable all btn ?? Thanks in advice ! Toni
Hello again, i've named a list of buttons like "btn" when i mouseclicked one of them, i solve what btn clicked via .text attribute. When i try to disable buttons "btn.disable = true" it's disable only clicked button. It's true ? Or not ? If i need to disable or enable all btn ?? Thanks in advice ! Toni
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2014 #2 You need to use the Sender keyword to get the clicked button: B4X: Sub btn_Click Dim b As Button = Sender b.Text = "I was clicked" End Sub If you want to disable all buttons stored in a list: B4X: For Each b As Button In ListOfButtons b.Enabled = False Next Upvote 0
You need to use the Sender keyword to get the clicked button: B4X: Sub btn_Click Dim b As Button = Sender b.Text = "I was clicked" End Sub If you want to disable all buttons stored in a list: B4X: For Each b As Button In ListOfButtons b.Enabled = False Next
moore_it Well-Known Member Licensed User Longtime User Nov 17, 2014 #3 I need to create a listofbuttons ? I've four buttons with ID = btn on my screen not work like an array of objects ? Upvote 0
I need to create a listofbuttons ? I've four buttons with ID = btn on my screen not work like an array of objects ?
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2014 #4 Depends on what you are trying to do. You can iterate over all views and disable the buttons if you like: B4X: For Each v As View in Page1.RootPanel.GetAllViewsRecursive If v Is Button Then Dim b As Button = v b.Enabled = False End If Next Upvote 0
Depends on what you are trying to do. You can iterate over all views and disable the buttons if you like: B4X: For Each v As View in Page1.RootPanel.GetAllViewsRecursive If v Is Button Then Dim b As Button = v b.Enabled = False End If Next
moore_it Well-Known Member Licensed User Longtime User Nov 17, 2014 #5 Thanks Erel, I get it. Toni Upvote 0