BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-16-2008, 12:58 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How to close a menu?

Please Login to Remove!

Is there any way to close a menu manually?

when one of my menu is open and i am pressing red button, my application goes to background. when i comes back to the application the menu will be open.

In some cases its ok for me, but in some cases i want to close that menu..

Please suggest a solution for this.....
Offline  
Old 04-16-2008, 05:12 AM   #2 (permalink)
CrackBerry Addict
 
Foxglove's Avatar
 
Join Date: Feb 2008
Model: 9900
PIN: N/A
Carrier: o2
Posts: 929
Post Thanks: 0
Thanked 1 Time in 1 Post
Default

Wirelessly posted

Hit the menu key (left of trackball and) select close or use the back key (to right of trackball beside red key)
Offline  
Old 04-16-2008, 05:29 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

I need to know how we can do this through program....

I tried to implement ESCAPE key event but its not working...
Offline  
Old 04-16-2008, 06:23 AM   #4 (permalink)
BBF Moderator
 
akosnitzky's Avatar
 
Join Date: Jul 2005
Location: Southern Florida
Model: 9650
OS: 6.0.0.333
Carrier: Verizon BIS
Posts: 14,484
Post Thanks: 6
Thanked 7 Times in 7 Posts
Default

Wirelessly posted (Verizon 8830)

There should be a one button shortcut to close apps but there is not.
__________________
------
Follow @akosnitzky on Twitter

LET'S GO CANES!
Offline  
Old 04-16-2008, 07:25 AM   #5 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

somebody please tell me a way to close a menu without pressing a key..

(through code)
Offline  
Old 04-16-2008, 07:30 AM   #6 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not tried it but something like this might work, add it to your mainscreen class:

public void onExposed() {
this.getMenu(Menu.INSTANCE_DEFAULT).close();
}
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 04-16-2008, 08:23 AM   #7 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

Thanks for the code you gave...

Unfortunately i can't use this code...

because my menu comes up after the exposed event is occured...

In my application i am getting an unwanted menu and i want to close that..

when i open a screen from my main screen and close that screen, main screens menu comes up.

for main screen
onExposed event , the visibility of the screen is false.

then it goes to make menu method there also the visibility of the screen is false.

after makemenu the visibility state becomes true.

I tried your code on visibility change, still this menu comes up
Offline  
Old 04-16-2008, 09:15 AM   #8 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

how about overwriting makemenu and call menu.deleteall to remove all menu entries?
anyhow, some strange behaviour you got there!
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 04-16-2008, 09:21 AM   #9 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

deleting all items from menu will give an <empty menu> when the menu is invoked...,

is there any way by which <empty menu> will not come when no menu items are there in the menu?

I can set a flag for the exceptional case which i am getting and if the flag is true i will delete all menuitems. But still a menu with<empty menu> entry will come. how can i remove that also?
Offline  
Old 04-16-2008, 09:31 AM   #10 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you post a code-snippet showing the behavior you're describing? otherwise we're all just playing a guessing game.

If I'm reading what you say correctly the MainScreen onExposed method isn't firing when you return to your application because the menu is open (and therefore the screen isn't exposed - this is guesswork, not 100% sure). What you could do here is use:

public class myApp extends UiApplication {
MyScreen screen = new MyScreen();

public static void main(String[] args) {
myApp instance = new myApp();
instance.enterEventDispatcher();
}

public myApp() {
pushScreen(screen);
}

public void activate() {
screen.getMenu(Menu.INSTANCE_DEFAULT).close();
}
}

'activate' is a method within your UiApplication class that is called when your app is brought to the foreground.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!

Last edited by jfisher : 04-16-2008 at 09:33 AM.
Offline  
Old 04-16-2008, 09:56 AM   #11 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

on exposed event is getting fired.. inside that i am checking whether the screen is visible or not... when on exposed event is occurring screen.isvisible() is returning false. then the makemenu event is getting fired. there also visibility is false. once the menu is opened, the screens visibility is becoming true...

and this problem happens only when the screen contains an ObjectListField.

what happens in my case is I have a screen with an ObjectListField, which contains 5 items. i have add, edit and delete in my menu.

when i delete an item a new popup screen comes up where u have to enter password. enter password and click trackball if the password is correct, the password screen will get closed and item gets deleted.

then you will come back to the screen where the ObjectListField is there.

then the above metioned problem happens ie the menu of the screen is poping up...



if you edit or add new enements, a new screen will come and you can add elements to the ObjectListField and you save it.the screen will get closed and will come back to the ObjectListField's screen.

in this case menu is not poping up in simulators, but when u install it and run in blackberry device, it comes up
Offline  
Old 04-16-2008, 10:13 AM   #12 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

so this isn't to do with pressing the red button and sending the app to the background? if the behavior only happens in a device and not the emulator it could be a bug, but i'm confused as i'm reading different things. if the popup is modal you could be returning false from the click event which is firing the menu after you pop the password screen - but without seeing the code i can't help anymore (and given the behavior is only seen on a real device it may well be a bug). anyone else have better clarity? i'm all out of ideas.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 04-17-2008, 03:04 AM   #13 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, in between i posted for another problem i was facing in this thread...

That unnecessary menu popping up problem, it got solved...

In this problem,


I tried your code:

public void onExposed() {
this.getMenu(Menu.INSTANCE_DEFAULT).close();
}


if the menu is open and you press red button and comes back to the application again, the menu is still open....

I tried some other methods also to close the menu, but menu is not getting closed....

Last edited by arunk : 04-17-2008 at 03:08 AM.
Offline  
Old 04-17-2008, 03:17 AM   #14 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

then i suggested trying the activate method... - i'm bailing out on this one, have spent too much time on it.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
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.