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
dognose
Posts: 51
Registered: ‎11-27-2008
My Device: Not Specified
Accepted Solution

Blackberry Storm / Buttons Click not working ... (opens Menu)

Hello,

 

im writing a little app for the Storm.

 

If i click a button in the app, the Storm just opens the Blackberry Menu (Simulator with 9000 works fine)

What am i doing wrong here ?

 

Eventhandler:

FieldChangeListener Flistener = new FieldChangeListener() { public void fieldChanged(Field field, int context) { ButtonField button = (ButtonField) field; /*check which button...*/ if (button.getLabel() =="create Playlist"){ UiApplication.getUiApplication().pushScreen(new PlaylistScreen()); } } };

 

Button:

/*Display Buttons for create...*/ ButtonField createButton = new ButtonField("create Playlist", ButtonField.FIELD_HCENTER); createButton.setChangeListener(Flistener); add(createButton);

 

 

regards,

dognose

Please use plain text.
Administrator
MSohm
Posts: 14,569
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Blackberry Storm / Buttons Click not working ... (opens Menu)

Is your FieldChangedListener firing?  Note that you can override the navigationClick method of ButtonField to capture when a user clicks on the button.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Blackberry Storm / Buttons Click not working ... (opens Menu)

dognose,

 

Another issue that you should be aware of is that the touch events are delegated from screen to manager to field. You can easily break this chain in an override in your screen or manager.

 

Make sure that you are properly re-delegating the events (that you do not consume) in any overrides of touchEvent(), navigationClick(), etc.

 

I've had several situations where we were inadvertantly "eating" a UI event and causing similar issues.

 

 

Please use plain text.
Developer
dognose
Posts: 51
Registered: ‎11-27-2008
My Device: Not Specified

Re: Blackberry Storm / Buttons Click not working ... (opens Menu)

oh, sry totally forgot this post ...

 

Well i managed to solve this problem, the Solution was, that i had to add the

 

ButtonField.CONSUME_CLICK

 

 

property to the Style of the Button Field, like this:

 

ButtonField Button1 = new ButtonField("Button that consumes Click",ButtonField.CONSUME_Click); add(Button1);

 

thx for your answers anyway.

dognose

Please use plain text.