Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 86
Registered: ‎01-09-2009
My Device: Not Specified
Accepted Solution

CheckBox current value

Hi,

 

I have added a checkbox to screen, but am unable to figure out how to know its current state(checked or not).

Can't find any event that is associated with this class. 

 

Has anyone had any luck with this or know how to go about this?

 

Thanks

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: CheckBox current value

hey,

 

since it extends the LabelButton class its considered the same. so if you add a MouseEvent.CLICK eventlistener you can know when a user clicks on it. from there just check the .selected property of the object and it should tell you if it has been checked or not. hope that helps. good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 86
Registered: ‎01-09-2009
My Device: Not Specified

Re: CheckBox current value

Thanks.

 

I used the (checkbox.selected == true)  and it seem to work.

 

Thanks

 

New Contributor
Posts: 2
Registered: ‎06-07-2011
My Device: 9800
My Carrier: Software developer

Re: CheckBox current value

[ Edited ]

Hi,

  you can use this one to check the status of the check box.

 

CheckboxField Checkbox1=new CheckboxField("checking",false,Field.FOCUSABLE);
        Checkbox1.setChangeListener(new FieldChangeListener(){
            public void fieldChanged(Field field, int context) {
                if (Checkbox1.getChecked()) {
                   System.out.println("----------checked is true");
                }else {
                    System.out.println("----------checked is false");
                }
            }
        });


Its working fine for me.