BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-15-2007, 09:42 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8700c
PIN: N/A
Carrier: AT&T
Posts: 32
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default popupScreen + KeyListener

Please Login to Remove!

I'm trying to code a popupScreen that displays some information and upon a keypress, it disappears. I was trying to do something like this..


Code:
UiApplication.getUiApplication().pushScreen(popupScreen);
That pushes the popupScreen with the label containing the message i want displayed. I added the keylistener to popupScreen.

Code:
popupScreen.addKeyListener(popupScreenKeyListener);
I defined the listener as follows..

Code:
private KeyListener popupScreenKeyListener = new KeyListener()
{
    public boolean keyStatus(int keycode, int time)
    {
        UiApplication.getUiApplication().popScreen(popupScreen);
        return true;
    }
    public boolean keyRepeat(int keycode, int time)
    {
        UiApplication.getUiApplication().popScreen( UiApplication.getUiApplication().getActiveScreen() );
        return true;
    }
    public boolean keyDown(int keycode, int time)
    {
        return true;
    }
    public boolean keyUp(int keycode, int time)
    {
        UiApplication.getUiApplication().popScreen( UiApplication.getUiApplication().getActiveScreen() );
        return true;
    }
    public boolean keyChar(char key, int keycode, int time)
    {
        UiApplication.getUiApplication().popScreen( UiApplication.getUiApplication().getActiveScreen() );
        return true;
    }
};
Neither popScreen(popupScreen) nor the .getActiveScreen() method seem to be popping the popupscreen.

Any ideas as to what i'm doing wrong or missing? Or is there another way of creating a screen with no buttons or images (just text) that goes away when the user presses any key?
Offline  
Old 11-15-2007, 10:55 AM   #2 (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

override the keyCar method for popupscreen, you don't need to add a specific key listener:

public boolean keyChar(char key, int status, int time) {
boolean retval = false;
switch (key) {
case Characters.ESCAPE:
UiApplication.getUiApplication.popScreen(UiApplica tion.getUiApplication.getActiveScreen());
return true;
default:
retval = super.keyChar(key, status, time);
}
return retval;
}
__________________
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 11-15-2007, 11:14 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8700c
PIN: N/A
Carrier: AT&T
Posts: 32
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Got it to work. Also added a trackwheelListener for added functionality. I appreciate the help.
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

MSA Altair 4x Multi Gas 10107602 Detector O2 CO H2S LEL Warranty Calibrated
$525.0
MSA Altair 4x Multi Gas 10107602 Detector O2 CO H2S LEL Warranty Calibrated pictureMSA Altair H2S Hydrogen Sulfide Single Gas Detector
$30.0
MSA Altair H2S Hydrogen Sulfide Single Gas Detector pictureMSA 10089321 Calibration Assembly with Cap, Tube and Connector for Altair 4 Gas
$25.58
MSA 10089321 Calibration Assembly with Cap, Tube and Connector for Altair 4 Gas pictureNEW MSA 10042621 Sampling Probe For Use With ALTAIR Multi-Gas Detector
$99.99
NEW MSA 10042621 Sampling Probe For Use With ALTAIR Multi-Gas Detector pictureMsa H2S Altair Pro Single Gas Detector,Calibration Cert Included,Glow-n-Dark
$54.99
Msa H2S Altair Pro Single Gas Detector,Calibration Cert Included,Glow-n-Dark picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.