BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-11-2007, 11:57 AM   #1 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default TrackWheelClick

Please Login to Remove!

For my MIDlet, I've implemented a class to use the TrackWheelListener to create a Menu on the fly. I'm able to display my custom Menu and control it via the TrackWheelClick() method ovveride. However, all the items in the menu only works as it should if I use the enter key. If I use the click event to trigger the menu item by returning false, it works the first time it is instantiated. On a following screen, when I trigger a new menu, but when i select an item it triggers another menu on top of the current menu. If I make the click method return true after clicking while the menu is displayed, nothing happens. Any help or insight would be appreciated. Also, I notice that if you have a Menu displayed and a click event come in to select the menu item, the menu item is always null. It seems like there i not a way to get the selected menu item on the click.
Offline  
Old 07-11-2007, 02:02 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

what does your create menu subroutine w/i TrackWheelListener look like? My guess off the top of my head would be that you might be returning super.makeMenu instead of just false, which could complicate things.
Offline  
Old 07-11-2007, 02:17 PM   #3 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post

bemshaswing,

In the class that I implement the TrackWheelListener, I simply create a new Menu, then create MenuItems and add them to the menu. Below is the click method that I override,

public boolean trackwheelClick(int status, int time) {

if(_menu.isDisplayed()){
return false;
}else{
_menu.show();
}
return true;

}

Is it possible that it calls super.makeMenu() considering I'm not extending any screens? Also I noticed that Menu's show() method return the selected item's index, how does this work if I can call show() if it's already displayed in order to get the selected index?
Offline  
Old 07-11-2007, 02:22 PM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think what you want to do is:

public boolean trackwheelClick(int status, int time) {

if(_menu.isDisplayed()){
//do whatever you want and return true

}else{
return false
}

false implies that the action was not consumed and the manager should take over. the manager will then fire off the menu for you

Last edited by bemshaswing : 07-11-2007 at 02:24 PM.
Offline  
Old 07-11-2007, 02:26 PM   #5 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the case were the menu is displayed, how do I execute the item in the menu via the click from the trackwheel?
Offline  
Old 07-11-2007, 02:32 PM   #6 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

it should automatically do that, you mean execute something from the menu with an action other than trackwheel?
Offline  
Old 07-11-2007, 02:41 PM   #7 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's the thing, once I have the ability to capture TrackWheel click events, a new Menu has been created and populated. All I would like to do it show the menu when the click event is caught then select the menu's items via the click event.

I tried your logic and a menu does appear, but only with "Close" which I believe is handled by the manager. If this is the only way for it to work properly, then how would you add you custom menuitems to the menu that contains the "Close" option?
Offline  
Old 07-11-2007, 07:31 PM   #8 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

After some further testing, I've found that every time I create my class to build a menu, the menu remains in memory even though I've created a another instance. Is there a way to completely destroy a menu? Or at least find out how many instances of the Menu have been created?
Offline  
Old 07-12-2007, 09:59 AM   #9 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

in that class implement your own method makeMenu , then add menuItems to menu like so
protected void makeMenu(Menu menu, int instance) {

menu.add([Some new MenuItem()]);
super.makeMenu(menu,0);
}
Offline  
Old 07-12-2007, 12:07 PM   #10 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: att
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help, that actually didn't work for me but after some more debugging I found the issue and fixed it.
Offline  
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 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.