3 Replies Latest reply on Aug 15, 2007 8:57 AM by jmryan

    Checkbox - Click event

    Misenko Level 1
      Hi, I don't know understand how I can override CheckBox default click event with my own. I want to do, that if I click with left mouse button on the ceheckbox, nothing will happen. It means, that checkbox after clicking is not selected or deselected. I've tryied event.preventDefault () in the click event but it had no effect.

      Thanks for help.
        • 1. Re: Checkbox - Click event
          HyderAlamgir
          As far as I know event.preventDefault() will only prevent the checkbox from returning the data value. I'm expecting somebody else to correct/elaborate this. I'm by no means an expert in flex.

          Since checkbox has only 2 values, u can simply revert to the original value.

          event.currentTarget.selected = !event.currentTarget.selected
          • 2. Re: Checkbox - Click event
            Misenko Level 1
            quote:

            Originally posted by: Hyder_m29
            As far as I know event.preventDefault() will only prevent the checkbox from returning the data value. I'm expecting somebody else to correct/elaborate this. I'm by no means an expert in flex.

            Since checkbox has only 2 values, u can simply revert to the original value.

            event.currentTarget.selected = !event.currentTarget.selected


            Thank you very much for quick answer. It works for me pretty well. Although, I would like to know if it is even possible to override this default event click behaviour.
            • 3. Re: Checkbox - Click event
              jmryan Level 1
              You could extend the checkbox class and override the protected ClickHandler function.