Android Question Progressive loop button

herryj

Member
Licensed User
Hi masters, Is there a way how to enable button1 to button9 to false and only enable button0 to true and after a certain events. button0 and button1 enable=true then after and action again, button0, button1, button2 enable=true till if finish to enable button9.

Really appreciate you help guys!
Many thanks advance.
 

DonManfred

Expert
Licensed User
Rembrandt? Train-Station?

Really i do not understand what the question is... You should descriobe it more clearly what you want to archive.
 
Upvote 0

herryj

Member
Licensed User
Hi @DonManfred, i have loop 9 buttons

I want

if firsttime
btn1 are only enabled
after an event
btn1,btn2 enbled
next
btn1,btn2,btn3 enbled
next
btn1,btn2,btn3,btn4 enbled
next
btn1,btn2,btn3,btn4,btn5 enbled
 
Upvote 0

KMatle

Expert
Licensed User
At any time you can set the btnx.enable=true or false.

At the start you only have btn1 enabled

B4X:
Sub Activity_Create(FirstTime As Boolean)
    btn1.enabled=true
    btn2.enabled=false
    btn3.enabled=false

    ...
    
End Sub

Clicking on btn1 will call btn1_click and there btn2 is enabled

B4X:
SUB btn1_click
       btn2.enabled=true
END SUB

B4X:
SUB btn2_click
       btn3.enabled=true
END SUB

B4X:
SUB btn3_click
       btn4.enabled=true
END SUB

etc.

There are better ways to create x buttons or other views ;-)
 
Upvote 0

buras3

Active Member
Licensed User
B4X:
'put tags In buttons acording To the names : button1 tag =1 etc.
Sub Enable_Buttons(FromB As Int,UntilB As Int)
For i = 0 To Activity.NumberOfViews - 1
  If Activity.GetView(i) Is Button Then
       If Activity.GetView(i).tag>=FromB AND Activity.GetView(i).tag<=UntilB Then
       Activity.GetView(i).Enabled=True
       End If
    End If
  Next
End Sub

I didn't test this function so change the operators if needed
 
Last edited:
Upvote 0
Top