Hi Everyone:
I've been trying to get the menu button to display a context menu in my application. I have multiple screens, and I have a ui class handling listening for key presses like so:
Code:
else if (key == Keypad.KEY_MENU)
{
// menu key was pressed
Menu m = parent.getActiveScreen().getMenu(0);
m.show();
}
Now, I also have the following, on a specific screen ("options" screen of my application):
Code:
private MenuItem saveData = new MenuItem("Save", 110, 10)
{
public void run()
{
// perform saving functionality
}
};
private MenuItem cancel = new MenuItem("Cancel", 110, 10)
{
public void run()
{
// cancel by popping the screen off the stack
Screen currentScreen = getUiEngine().getActiveScreen();
getUiEngine().popScreen(currentScreen);
}
};
public OptionsMenu()
{
// We set the title on the screen
LabelField title = new LabelField("Application Options", LabelField.FIELD_HCENTER);
setTitle(title);
addMenuItem(saveData);
addMenuItem(cancel);
}
It works ok, but there are two problems: 1) The menu displays in the upper right corner of the screen, and I'd like it to display in the bottom left corner of the screen, like other BB applications, and 2) if I have the menu open, and press the menu key again, it opens another menu (I can't tell what it says, because it's rendered off screen). I'd like to disable this multiple menu situation.
Can someone give me some idea of what I'm doing wrong? I've tried searching google, as well as reading through API docs, but can't seem to find what I'm looking for.
Thanks in advance,
~Jwir3