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
duksunkim
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.

Please use plain text.
Developer
peter_strange
Posts: 19,601
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); }

 

Please use plain text.
Developer
duksunkim
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Dismiss PopupScreen

Peter,

 

I got the idea and it works.

 

Thanks,

DK.

Please use plain text.