09-08-2008 08:26 PM
Simulator: 8330
I see the "Full Menu" text at the bottom of my BB screen after I change the value of an on-screen field. This seems to be happening because of a navigationUnclickUnhandled "event." I'm not sure how to avoid this unexpected behavior.
btnCalculate.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
if (context != FieldChangeListener.PROGRAMMATIC) {
double mpg = calculateMpg(milesDriven.getText(), gallons.getText());
System.out.println("MPG: " + mpg);
String clipboardDate = (new SimpleDateFormat("MM/dd/yyyy")).formatLocal(entryDate.getDate());
float roundedMpg = (float)((int)(mpg*10000)) /(float)10000;
String outputText = vehicleChoice.toString() + ": " + clipboardDate + " " + roundedMpg;
Clipboard.getClipboard().put(outputText);
outputLine.setText(outputText);
} else {
System.out.println("System changed button");
}
}
});
Stepping through the debugger, the following occurs just before the "Full Menu" menu is displayed in the bottom center of the screen:
DataEntryScreen(Screen).navigationUnclickUnhandled
(int, int) line: 3986
If I comment the outputLine.setText(outputText); statement, the unwanted prompt doesn't appear. I don't know how to "handle" the navigationUnclick.
I'd like to display the results of the calculation on the screen, but if there is a better way to do it, I'm open to suggestions!
Solved! Go to Solution.
09-08-2008 09:31 PM
Solved it.
Define the Calculate button as follows
ButtonField btnCalculate = new ButtonField("Calculate", ButtonField.CONSUME_CLICK+ButtonField.FIELD_HCENTE
R);