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
patilajayr
Posts: 404
Registered: ‎07-28-2010
My Device: 8000
My Carrier: hi

how to Transition from one screen to another screen.

hello friends,

                       i want to give slide effecte to my applicatin. i use that transition sample code in my code but didnt get right.

            i am attaching my code.

import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.PasswordEditField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.BackgroundFactory;

public class LoginTb extends MainScreen implements FieldChangeListener, KeyListener
{
	boolean focus;
	Bitmap imgheader,textfield,login;
	BitmapField loginbtm;
	VerticalFieldManager vfm;
	HorizontalFieldManager hfm;
	LabelField lbl1,lbl2,lbl3,lbl4,lbl5;
	HorizontalFieldManager hfm1,imghfm;
	
	CustomLabel lblusername,lblpassword,headerInfo;
	EditField _username;
	PasswordEditField edpass;
	//ButtonField submit;
	CustomButtonField btnsubmit,btncancel;
	
     LoginTb()
     {
            
    	 add(vfm);
    	
     }
    
     protected void paint(Graphics g)
 	{
 		g.setBackgroundColor(Color.BLACK);
 		g.drawBitmap(41, 109, imgheader.getWidth(), imgheader.getHeight(), imgheader, 0, 0);
 		g.clear();
 		g.setColor(Color.BLACK);	
 		subpaint(g);	
 	}
     
     public boolean keyChar(char character, int status, int time)
     {
         switch (character) 
         {
             case Characters.ESCAPE:
                  System.exit(0);
                  return true;
             case Characters.ENTER:
            	 if(_username.getTextLength()==0 || edpass.getTextLength()==0)
         		{
         			 Dialog.alert("You must enter user name and password");
         		}
         		else
         			 //
i want to give slide effect on that push screen.
         			 UiApplication.getUiApplication().pushScreen(new Menu_Page());
            
             	  return true;
             default:
                 return super.keyChar(character, status, time);
         }
     }
        public boolean keyDown(int keycode, int time) { return false; }
 	public boolean keyRepeat(int keycode, int time){ return false; }
 	public boolean keyStatus(int keycode, int time) { return false; }
 	public boolean keyUp(int keycode, int time) { return false; }
    	
}

 

 

i am using following code for slideing. 

http://docs.blackberry.com/en/developers/deliverables/11958/Screen_transitions_detailed_overview_806...

 

how should i give that page slideing effect code in my class?

 

thanks.

 

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to Transition from one screen to another screen.

I think the sample and explanation in here:

http://www.naviina.eu/wp/blackberry/simple-transition-screen-example-for-blackberry-5-0-beta/

is quite good for explaining how to get transistions going.

 

Alos I think this code is not right if all you are trying to do is paint and clear the background, I specifically don't think you should be calling subpaint. 

 

protected void paint(Graphics g)
{
g.setBackgroundColor(Color.BLACK);
g.drawBitmap(41, 109, imgheader.getWidth(), imgheader.getHeight(), imgheader, 0, 0);
g.clear();
g.setColor(Color.BLACK);
subpaint(g);
}

 

Instead of doing this, I would recommend that you remove this code and replace it with the following:

 

protected void paintBackground(Graphics g)
{

int backCol = g.getBackgroundColor();

try {
g.setBackgroundColor(Color.BLACK);
g.clear();
g.drawBitmap(41, 109, imgheader.getWidth(), imgheader.getHeight(), imgheader, 0, 0);
} finally {

g.setColor(backCol);

}
}

Please use plain text.
Developer
patilajayr
Posts: 404
Registered: ‎07-28-2010
My Device: 8000
My Carrier: hi

Re: how to Transition from one screen to another screen.

that is not work. i want just left to right sliding effect when i use

UiApplication.getUiApplication().pushScreen(new Menu_Page());

this statment. how should i show sliding effect. i get that link. but didnt get anything in that link.

Thanks and regards,
Ajay patil.
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to Transition from one screen to another screen.

I was not saying my code changes would fix your slide, I was just saying it looked wrong to me.

 

I can see the link I supplied, I suggest you try the link on another PC or using another Browser if you don't see the code sample included there. 

Please use plain text.