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
Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified
Accepted Solution

Dismiss PopupScreen

Hi all,

 

I've created PopupScreen over main Screen but now I would like to dismiss the popupscreen by Escape key.

How would I do that?

 

Thanks in advance.

DK.

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Dismiss PopupScreen

PopupScreen extends Screen, which has a keyChar method, which is what I normally override to provide this functionality.

 

So basically all you need do is add a keyChar method like the following to your PopupScreen.  (note following code has not been compiled or tested, but should show you what you need to do). 

 

protected boolean keyChar(char c, int status, int time) { if ( key == Characters.ESCAPE ) { UiApplication.getUiApplication().popScreen(this); return true; } return super.keyChar(key,status,time); }

 

Highlighted
Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Dismiss PopupScreen

Peter,

 

I got the idea and it works.

 

Thanks,

DK.