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

Java Development

Reply
Developer
arunbiet
Posts: 384
Registered: ‎06-22-2010
My Device: na

checkboxfield checked/unchecked issue

I have a CheckboxField.If i click on a touchscreen device,it doesnt get checked/unchecked wheas if i click on the trackpad than its happening smoothly

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: checkboxfield checked/unchecked issue

do you have any touchevent or navigationclick handling on the screen, manager or field level?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
arunbiet
Posts: 384
Registered: ‎06-22-2010
My Device: na

Re: checkboxfield checked/unchecked issue

yes nav n touch event are there in the HFM where i am adding the checkboxfield

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: checkboxfield checked/unchecked issue

check if you consume the event, if you do the checkbox will not receive it.
you can either return super to let the event pass or change the checkbox status yourself.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
arunbiet
Posts: 384
Registered: ‎06-22-2010
My Device: na

Re: checkboxfield checked/unchecked issue

In my hfm touchEvent i am doing something like this 

 

 if (eventCode == TouchEvent.UP) {

               if (!this.isFocus()) {

                      this.setFocus();

                      invalidate();

               }

               return true;

        } else if (this.isFocus() && eventCode == TouchEvent.UNCLICK) {

        	AppComponent.getAppComponent().loadPage(onclick);

               return true;

        }
        }
     
        return super.touchEvent(event);

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: checkboxfield checked/unchecked issue

try returning super in all cases and see if the checkbox works
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
arunbiet
Posts: 384
Registered: ‎06-22-2010
My Device: na

Re: checkboxfield checked/unchecked issue

No luck

Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: checkboxfield checked/unchecked issue

Check the value of: this.isFocus() when entering the code block above.

I think that you are getting a different value from what you are expecting...

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

I agree with Re: checkboxfield checked/unchecked issue

I agree with maadani.

 

Also remember that a HFM is not really a focusable element, so, in my opinion anyway, you really should not be setting focus in the way you are doing.  This will be playing havoc with the HFMs attempt to manage focus for its Fields. If you really need to do something like this, then just use these events to change the UI.  But let a focusable Field in the HFM take the click event.  Add a NullField if you need to and have it process the event.