BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 01-26-2008, 02:57 PM   #1 (permalink)
New Member
Join Date: Jan 2008
Model: 8320
Carrier: Verizon
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How do you HIGHLIGHT a menu item?

Please Login to Remove!

How do you simply HIGHLIGHT whatever menu item you want
from within your own BB application?

The RIM Class MenuItem documentation Field summary shows
static int flags like 'SELECT' and 'CANCEL_SELECT' but the
Method summary for the class doesn't give you a clue what,
if anything, you can do with these commands.

The 'Menu' class ( Parent class for MenuItem? ) has the
obvious setDefault() and setItemHighlight() methods but
how do you just simply 'call' these parent Class 'Menu'
methods from within your own application?

Would it be some kind of 'super.setDefault()' call from
within the constructor of your own 'MenuItem'?

All I want to do is the same thing I see native RIM apps doing.

If I have added screen jump menu items to my own application
menu that lets the user go from screen to screen within the (same)
application then whatever screen the person is currently on...
when they press the MENU button again the last menu item
chosen should stay HIGHLIGHTED until they pick another menu
item and jump to another screen.

This ought to be simple. What am I missing here?
Old 01-26-2008, 04:14 PM   #2 (permalink)
New Member
Join Date: Jan 2008
Model: 8320
Carrier: Verizon
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts

Answering my own question here...

What I appear to missing are brain cells.

When 'makeMenu' is called you then have a pointer to 'menu'
and anywhere within the 'makeMenu' override while you are
creating your MenuItems you can just call...

menu.setDefault( (MenuItem) my_menu_item );

If you want to set/change the default menu item AFTER
'makeMenu' or at some other run-time point within your
application then all you have to do is 'remember' what
the last 'menu' handle was passed to the last 'makeMenu'

Create yourself a 'global' that can seen from all 'screens'
such as...

static Menu _menu = null;

...and then every time 'makeMenu' is called anywhere
in your application just update it with the 'Menu'
pointer being passed to you by 'makeMenu'...

_menu = menu;

Then, from anywhere in your application, as long as you
have also saved the 'MenuItem' handles for your own
menu items saved to globals as well you can just call...

_menu.setDefault( (MenuItem) my_menu_item );
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Copyright 2004-2014
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.