Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Need To Hide Default Menu but NOTHING WORKS

Hi all

 

I have facing a problem when I load the screen here is the discription

 

I have two contros on my screen

1.ButtonField with Consume Click Event

2.List field

 

And OnDisplay Method that shows a pop up with OK CANCLE button(With help of Dialog.ask())

 

when this pop up appears and I press the cancle button I see the default menu

(Show Keyboard,Switch Application and Full Menu).

 

and I have to disable this thing.

 

I have tried CONSUME_CLICK,onNavigationClick() method and also a super constructor call as suggested in previous posts on forum but nothing works.

 

 

What should I do

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: Need To Hide Default Menu but NOTHING WORKS

CONSUME_CLICK works for me.  I suspect there is a bug in the code and we need to see it to help. 

 

But don't just post your code.  You will loads of application stuff in there.  Instead recreate a version of it in a test app, and get it failing in that.  Then you only need to post the test app which is just stuff that is related to your problem, and we don;t get confused with stuff that is related to your application. 

Please use plain text.
Developer
gercoder
Posts: 46
Registered: ‎06-11-2009
My Device: Bold 2 - Pearl 8120

Re: Need To Hide Default Menu but NOTHING WORKS

Hi,

 

      Your problem is when you press Cancel button from Dialog.ask?, or when you press the ButtonField from your screen?

 

You implemented navigationClick, for wich control?, and can you copy the implementation of navigationClick? are you returning true?

 

Regards,

If your issue is resolved, please mark this thread as solved. Click "Accept as solution" on the post that contains the answer to your question.
Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Need To Hide Default Menu but NOTHING WORKS

The problem rises when I press the cancle button from Dialog.ask.

 

And didn't implement navigationClick from any particular control.

 

And here is the code of my navigation click.

 

protected boolean navigationClick(int status, int time) {
        return true;
    }

 

but it didn't work here.

 

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: Need To Hide Default Menu but NOTHING WORKS

As noted in my previous post, what you are doing should work.  Can we see the sample code?

Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Need To Hide Default Menu but NOTHING WORKS

[ Edited ]

Here is the sample code for the list screen (Test Screen Suggested by Peter)

 

//import Section

 public class TestListScreen extends MainScreen { //Declarations public TestListScreen() { // setup the application title m_lblTitle = new LabelField(handler.getName(), LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); setTitle(m_lblTitle); // create a group of buttons HorizontalFieldManager buttons = new HorizontalFieldManager( HorizontalFieldManager.FIELD_HCENTER); // add a button for the user to find the about screen ButtonField btn = new ButtonField(_resources.getString(ABOUT_BUTTON), ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK); btn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field target, int context) { //Handle Events } }); buttons.add(btn); if (quizFlag) { // add a button for the user to find the quiz screen btn = new ButtonField("Quiz", ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK); btn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field target, int context) { //Handle Events } }); buttons.add(btn); } if (formsFlag) { // add a button for the user to find the quiz screen btn = new ButtonField("Forms", ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK); btn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field target, int context) { //Handle Events } }); buttons.add(btn); } add(buttons); add(new SeparatorField()); // load the list of videos m_vector = new Vector(); //Code to insert data into m_videos // create a list (UI Field) of all the movies m_list = new ExtendedListField(); //This Extended List field is custom list field component. for (i = 0; i < m_videos.countVideos(); i++) { m_list.insert(i, m_viector.elementAt(i)); } add(m_list); // add an event handler to the list for onNavigate event (click or // enter.....Custom Listener) m_list.setNavigationListener(new NavigationListener() { public void navigate(int index) { m_videoIndex = index; onVideoClick(); } }); // setup the menu MenuItem mi; mi = new MenuItem(_resources.getString(DOWNLOAD_ALL_MENU), 2, 10000) { public void run() { //Handle Menu Event } }; addMenuItem(mi); mi = new MenuItem(_resources.getString(DELETE_VIDEOS_MENU), 2, 10000) { public void run() { //Handle Menu Event } }; addMenuItem(mi); mi = new MenuItem(_resources.getString(DELETE_SELECTED_MENU), 2, 10000) { public void run() { //Handle Menu Event } }; addMenuItem(mi); mi = new MenuItem(_resources.getString(CHANGE_LANGUAGE), 2, 10000) { public void run() { //Handle Menu Event } }; addMenuItem(mi); } public void onDisplay() { super.onDisplay(); // open a popup to check if the user wants to download all the videos // (when this screen is displayed) checkDownloadAll(); } public void checkDownloadAll() { //hasSDCard() is to determine whether SD card is accessible if (!anotherClass.hasSDCard()) { Dialog.alert(_resources.getString(NO_SD_CARD)); return; } Vector vids_only = new Vector(); //Here is the Block to Determine The downloadAllFlag which decides whether to show or not the message with that Dialog.ask() if (downloadAllFlag) { int result = Dialog.ask(Dialog.D_OK_CANCEL, _resources .getString(DOWNLOAD_ALL)); if (result == Dialog.D_OK) { // setup the progress bar screen m_progress.reset(); UiApplication.getUiApplication().pushScreen(m_progress); // download the videos m_downloader.download(vids_only); } else if(result==Dialog.CANCLE){ //Tried To Handle The Cancle Button Event Here But Still Getting Menu } } } protected boolean navigationClick(int status, int time) { return true; } public void onVideoClick() { //This method is called from invokeAction From The List Field. //To Handle the Selection Of particular Item. } public boolean onClose() { try { if (this.levelId > 1) jumpBack(); else System.exit(0); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } close(); return true; } //Jumps Back to previous level Which is the same List Field (The List is redrawn W.r.t. levels) private void jumpBack() { //Code For Jumping Back. } }

 

Here is my Code.I hope it is enough to describe my problem.

 

Thank you all for your replys.

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: Need To Hide Default Menu but NOTHING WORKS

As noted in my original post, please don't just paste your code in.  We can't take that code and test it ourselves, because it has loads of stuff that is specific to your application.  In addition, there is stuff in there that is not related to the problem.  So you are asking us to do work that we don't need to.  If you want us to help, you should make it as easy as possible for us. 

 

So please recreate the problem using a self contained bit of code that you can give us and we can run.

 

This could actually resolve your problem.  By attempting to recreate it, I suspect you will find your problem. 

Please use plain text.