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

HHED63B030 NEW IN BOX - Siemens Circuit Breaker - Free UPS Ground
$265.0
HHED63B030 NEW IN BOX - Siemens  Circuit Breaker - Free UPS Ground pictureSiemens SITOP PS300M Power Supply 6EP1437-3BA10 24 VDC 40 Amp 400-500VAC 3 Phase
$282.99
Siemens SITOP PS300M Power Supply 6EP1437-3BA10 24 VDC 40 Amp 400-500VAC 3 Phase pictureMembrane Keypad + Touch Screen Glass for SIEMENS SIMATIC 170 6AV6545-4BC16-0​CX0
$119.99
Membrane Keypad + Touch Screen Glass for SIEMENS SIMATIC 170 6AV6545-4BC16-0​CX0 pictureFor SIEMENS 6AV6645-0CC01-0AX0 Mobile Panel 277 8" Screen Glass +Membrane Keypad
$105.99
For SIEMENS 6AV6645-0CC01-0AX0 Mobile Panel 277 83VF2213-0FC41-0AA0 NEW Siemens 3 pole 16 amp IEC Din Rail Mount Circuit Breaker
$100.0
3VF2213-0FC41-0AA0 NEW Siemens 3 pole 16 amp IEC Din Rail Mount Circuit Breaker picture






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