Android Question Next Position RadioButton

angel

Member
Licensed User
Longtime User
Hello

I have a panel with three RadioButtons, when I activate the ToggleButton on a label tells me the current position of RadioButton Label on and in another position the next RadioButton, it é miss using "Select / End Select 'as I can create a loop (Do While or For Next) that can know the current position and show a RadioButton Label next.

Thank you.

B4X:
Sub rbtTest_CheckedChange(Checked As Boolean)
    rbt = Sender
    RadioButtonIndex = rbt.Tag
    lblActualPosition.Text = "Actual Position " & rbt.tag
    resultat = rbt.tag
 
End Sub

Sub ToggleButton1_CheckedChange(Checked As Boolean)
 
    resultat2 = resultat

    If ToggleButton1.Checked = True Then
        Timer1.Enabled = True
        lblActualPosition.Text = lblActualPosition.Text
 
    Select resultat2
        Case 1
            lblNextPosition.Text = "Next Position RadioButton 2"
        Case 2
            lblNextPosition.Text = "Next Position RadioButton 3"
        Case 3
            lblNextPosition.Text = "Next Position RadioButton 1"
    End Select
 
    Else
        Timer1.Enabled = False
    End If
End Sub
 

Attachments

  • RadioButton.zip
    324.4 KB · Views: 187

klaus

Expert
Licensed User
Longtime User
What is the problem ?
What exactly do you want to do ?
I don't understand the logic and purpose of the code.
I would use an array of strings for the radiobutton texts and use indexes but as I don't know what you want to do it's difficult to give you a concrete advice.

Best regards.
 
Upvote 0

angel

Member
Licensed User
Longtime User
for example

I select the ToggleButton RadioButton3 and connect the timer starts counting, when connecting the ToggleButton want to automatic deselect RadioButton3 and select RadioButton1, and display on the lblNextPosition the next position is RadioButton1.

while in motion the timer every time you finish you have to skip a step.

thanks.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Could you explain more in detail step by step what you want to do ?
What do you mean with : I select the ToggleButton RadioButton3 and connect the timer starts counting ?
You select RadioButton3 and then click on ToggleButton ?

I don't see any counter in your code.
while in motion the timer every time you finish you have to skip a step. I dont understand either.

Best regards.
 
Upvote 0

angel

Member
Licensed User
Longtime User
I want to loop through the RadioButtons and jump from a position that is selected

example:
ForEach radiobuttonX As Control In groupBoxRadiobutton
 
Upvote 0
Top