Android Question Checkbox behavior

ocalle

Active Member
Licensed User
Longtime User
Hello Again, i have 4 checkboxes with 4 different option value, i need that when i click in one the other remain in blank(clean box), i assigned
the status change in each one but


B4X:
Sub Checkobratodas_CheckedChange(Checked As Boolean)
    Checkobrasfinalizadas.checked=False
    Checkobraspendientes.checked=False


    
    
End Sub

Sub Checkobrasfinalizadas_CheckedChange(Checked As Boolean)
    Checkobratodas.Checked=False
    Checkobraspendientes.checked=False
    
    
        
End Sub

Sub Checkobraspendientes_CheckedChange(Checked As Boolean)
    Checkobratodas.checked=False
    Checkobrasfinalizadas.checked=False
    
End Sub

That code works fine, but need do an extra click to choose a new one again and erase the others..
Sorry if i no explain so well in english

Regards and Thank you!
 

mc73

Well-Known Member
Licensed User
Longtime User
Note sure I understand well, but from what I see, perhaps you should add a 'checked to true' condition:
B4X:
Sub Checkobratodas_CheckedChange(Checked As Boolean)
   if checked then   
      Checkobrasfinalizadas.checked=false
      Checkobraspendientes.checked=False
   end if 

End Sub

Sub Checkobrasfinalizadas_CheckedChange(Checked As Boolean)
   if checked then     
      Checkobratodas.Checked=False
      Checkobraspendientes.checked=False
   end if 
    
End Sub

Sub Checkobraspendientes_CheckedChange(Checked As Boolean)
   if checked then     
      Checkobratodas.checked=False
      Checkobrasfinalizadas.checked=False
   end if     
End Sub
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
Why don't you use RadioButtons, they do exactly what you want.
Thanks valuable the advise, sometimes i see a few trees and not the forest
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
New
Understood!! i have a nest if-endif lost TY!!!
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
Thanks valuable the advise, sometimes i see a few trees and not the forest
I discovered that i have other radiobuttons and collide with the other options
 
Upvote 0

ocalle

Active Member
Licensed User
Longtime User
i need put this to work fine

B4X:
Sub Checkobratodas_CheckedChange(Checked As Boolean)
    
    If Checkobratodas.Checked Then
        estadoobras=0

    Checkobrasfinalizadas.checked=False
    Checkobraspendientes.checked=False
    End If
    
    



    
    
End Sub

Sub Checkobrasfinalizadas_CheckedChange(Checked As Boolean)

    If Checkobrasfinalizadas.Checked Then
        estadoobras=1

            Checkobratodas.Checked=False
        Checkobraspendientes.checked=False
    End If
    
    

    
        
End Sub

Sub Checkobraspendientes_CheckedChange(Checked As Boolean)

    If Checkobraspendientes.Checked Then
        estadoobras=2

        Checkobratodas.checked=False
        Checkobrasfinalizadas.checked=False
    End If
    
    
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…