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
technolgia
Posts: 96
Registered: ‎06-11-2009
My Device: Not Specified
Accepted Solution

Help with field Event handling

Hello All,

 

I have a screen which contains a list field and a set of navigation buttons on top. I have overridden the navigationClick method to handle the trackpad click/ touch events as shown in the method below:

 

 protected boolean navigationClick(int status, int time) {
        // TODO Auto-generated method stub
         Dialog.inform("Clicked List");
        return true;
    }

 

When the list is clicked or touched the output is as below:

 

List Focused.png

 

For the button i have used the setChangeListener as in the code below:

 

logoutButton.setChangeListener(new FieldChangeListener() {
            
            public void fieldChanged(Field field, int context) {
                // TODO Auto-generated method stub
                Dialog.inform("Clicked Button");
            }
        });

 

Now when the focus is on the button and i click on the button using the trackpad the navigationClick method gets invoked and not the fieldChanged method. The output is as below:

 

botton focused.png

 

Am i missing out on something? When the button is clicked using the tracpad i would want the fieldChanged method to be invoked. Kindly help me with this. Thanks in advance.

 

Regards,

S.A.Norton Stanley

 

Please use plain text.
Developer
simon_hain
Posts: 15,874
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Help with field Event handling

first, check if you created the button with CONSUME_CLICK.
as a second thing: does it only happen when you use touch?
----------------------------------------------------------
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
Please use plain text.
Developer
technolgia
Posts: 96
Registered: ‎06-11-2009
My Device: Not Specified

Re: Help with field Event handling

Hello Simon,

 

1. The button is created with CONSUME_CLICK. I tried removing this and the behaviour is still the same.

2. This is the behaviour on non touch devices too. However when the enter button is pressed the fieldChanged method gets invoked.

 

Thanking you,

Regards,

S.A.Norton Stanley

Please use plain text.
Developer
simon_hain
Posts: 15,874
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Help with field Event handling

did you overwrite navigationclick on the screen or on the listfield?
events are handled from top to bottom, and the screen gets the event first.
that means if you handle the click in the screen, the button never receives it.

you can either check getLeafFieldWithFocus to be the correct one, or overwrite navigationClick only for your listfield.
----------------------------------------------------------
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
Please use plain text.
Developer
technolgia
Posts: 96
Registered: ‎06-11-2009
My Device: Not Specified

Re: Help with field Event handling

Hello Simon,

 

Thank you. As you rightly pointed out the issue was that i had overwritten navigationclick on the screen. After moving the navigationclick to the listfield my issue was solved. Thanks again. :Yes:

 

Regards,

S.A.Norton Stanley

Please use plain text.