BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-15-2009, 06:17 PM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 7130v
PIN: N/A
Carrier: n/a
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default main menu appears automatically. why?

Please Login to Remove!

I'm using a button in a screen to close a screen and there is a listener which catch that event and opens a new screen.
but the main menu appears automatically for some reason on the new screen in the simulator.
i'm using jde 4.2.1 and 4.5.0
maybe it's only a problem with the simulator? because it happens if i click the track ball when i'm on the button in screen1, but it doesn't happen if i use the enter key on the pc keyboard...

App.java:
Code:
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;

public class App extends UiApplication implements ScreenClosedListener
{
   Screen1 screen1;
   Screen2 screen2;
   
    public static void main(String[] args)
    {
        App  app = new App();
        app.enterEventDispatcher();
    }
    public App()
    {
    	screen1 = new Screen1(this);
        pushScreen(screen1);
    }
    public void notifyScreenClosed(MainScreen screen)
    {
    	// check the event source object
    	if (screen == screen1)
    	{
    		 pushScreen (new Screen2());
    	}
    }
}
Screen.java:
Code:
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;


final class Screen2 extends MainScreen
{

   
    public Screen2()
    {
        super(); 
        setTitle(new LabelField("Screen2"));
    }
    public boolean onClose()
    {
	    return super.onClose();
    }
}
ScreenClosedListener.java:

Code:
import net.rim.device.api.ui.container.MainScreen;

public interface ScreenClosedListener 
{ 
	public void notifyScreenClosed(MainScreen screen);
}
Offline  
Old 07-15-2009, 07:52 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

You need to add the style CONSUME_CLICK to your button.
Offline  
Old 07-16-2009, 03:11 AM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Model: 7130v
PIN: N/A
Carrier: n/a
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, that did it!
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

Supermicro SBI-7226T-T2 Twin Intel Xeon 5500 Blade Module SBI7226TT2
$1068.31
Supermicro SBI-7226T-T2 Twin Intel Xeon 5500 Blade Module SBI7226TT2 pictureNew HP Proliant DL380 Gen4/ML370 Server Intel Xeon Processor 311584-B21
$50.99
New HP Proliant DL380 Gen4/ML370 Server Intel Xeon Processor 311584-B21 pictureDell Poweredge R710 2 X 6 CORE 2.66GHZ X5650 64GB MEMORY 2 X 146GB 10K SERVER
$295.0
Dell Poweredge R710 2 X 6 CORE 2.66GHZ X5650 64GB MEMORY 2 X 146GB 10K SERVER pictureDell PowerEdge R910 4x 1.86GHz Quad Core E7520 64GB ram 2x146GB HDD
$699.95
Dell PowerEdge R910 4x 1.86GHz Quad Core E7520 64GB ram  2x146GB HDD pictureUsed SUPER PDSM4+XEON 3010 #FY03 Motherboard overclocking available Quad works
$50.0
Used SUPER PDSM4+XEON 3010 #FY03 Motherboard overclocking available Quad works picture






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