Friday, September 23, 2005

BB : pushScreen always displays the menu on top

Really annoying problem. You invoke pushScreen and lo and behold the current menu pops up on top of the new screen. You have to escape out.

Lots of traffic on the Net about this. Half of the people say that it is not the default behavior and refer you to the Blackberry samples that don't exhibit this behavior. The other half say "Stuff the samples, I can SEE the problem and it's driving me nuts".

And the reason is the humble button (ButtonField). You aren't supposed to use buttons, rather add the action to the menu. But some users are Windows centric and WANT a button. The samples don't use a button; hence don't exhibit the behavior.

The problem is that the click is passed onto the next screen and so invokes the menu. The trick is to dump the click. You do this by:

bf = new ButtonField ("Submit", Field.FOCUSABLE | ButtonField.CONSUME_CLICK);

Problem solved.


No comments: