Android Question Make a check box read only without disabling?

Discussion in 'Android Questions' started by Tony Tetley, Apr 11, 2015.

  1. Tony Tetley

    Tony Tetley Member Licensed User

    I want to use check boxes to show some true/false values but I do not want the user to be able to change the value. If I disable the check box it is dimmed out and too hard to see. Is it possible to make a check box enabled but read only, or am I going to have to do a click event on each of them to keep the true/false state?

    Thanks,
    Tony
     
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    If you have several it might be easier to place a transparent panel over the top of the check boxes. This should then be able to consume the click event instead of it reaching the check boxes. I'm pretty sure it will work.
     
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    That sounds good idea @RandomCoder.

    EDIT: I just thought, shouldn't it still click through a transparent panel?
     
  4. Tony Tetley

    Tony Tetley Member Licensed User

    Thanks for the idea, but it does not work, it does click through the transparent panel.
     
  5. NJDude

    NJDude Expert Licensed User

    You have to add the TOUCH event in order to consume the tap/click/touch.
     
  6. Beja

    Beja Expert Licensed User

    Sub Panel1_Click
    Return
    End Sub

    Edit:
    implementation of RandomCoder and NJDude suggestions
     
    RandomCoder and Peter Simpson like this.
  7. Tony Tetley

    Tony Tetley Member Licensed User

    Yes!! adding the panel click event doe the trick. Thanks.
     
  8. Cableguy

    Cableguy Expert Licensed User

    Remembering the BASICS in BASIC...4 Android
     
    RandomCoder and Peter Simpson like this.
  9. NJDude

    NJDude Expert Licensed User

    Not the click but the TOUCH just like indicated below, otherwise you might get the clicking sound too:
    Code:
    Sub Panel1_Touch(Action As Int, X As Float, Y As Float)
    End Sub
     
  10. Tony Tetley

    Tony Tetley Member Licensed User

    Click and touch both work, but NJ dude is correct, the touch prevents the clicking sound.

    Thanks!
     
    DonManfred and RandomCoder like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice