Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to close a popup screen in blackberry bold

hey i have displayed a pop-up screen when i click on a menu item

now i want to close that pop-up screen when user presses escape key.but it does not work and remain stuck,till i click on a button on the pop=up screen.

how can i achieve that???? filter is my pop-up screen my code is :::

     protected boolean keyChar(char c, int status, int time)
         {
           boolean retVal = false;

          if (c == Characters.ESCAPE)   
          {       
              close();
           UiApplication.getUiApplication().invokeLater(new Runnable()
           {
         public void run()
         {
          //UiApplication.getUiApplication().popScreen(filter);
          UiApplication.getUiApplication().
popScreen(UiApplication.getUiApplication().getActiveScreen());//(filter);
         } 
        });
           retVal = super.keyChar(c,status,time);

          } 
       return retVal;     
         }
like image 944
Swati Avatar asked Jan 23 '23 08:01

Swati


1 Answers

i need to override the keychar method in pop-up screen,search for escape and then close

code :

 popupscreen1=new PopupScreen(myverticalfieldmanager)
            {
                protected boolean keyChar(char c, int status, int time) 
                {
                    if (c == Characters.ESCAPE)   
                       close();
                    return super.keyChar(c, status, time);
                }

            };
like image 120
Swati Avatar answered Jan 29 '23 23:01

Swati