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
New Developer
ganeshS
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Problem of scrolling in paint (MainScreen)

Hello Friends,

 

I have developed a registration screen using MainScreen. It works fine. Now I want my background to be in any color (lets say.. yellow). So, for this, I use " paint " method. My code is as follows to acheive this. It also works (i.e. it displays the screen with yellow background) but the scrolling is disabled now. I mean to sayscrolling is not taking place. What may be the problem?? I have two BBs.

1)  9700

2) 8100

 

In 9700 the screen size is largh enough so all components are displaying in single screen so no scrolling is required. But in 8100, screen size is small so some compnents are not getting displayed at first screen so scrolling is required and here I face problem of scrolling

 

Please let me know If I am wrong somewhere or I am missing something in my code.

 

 

 

		class Registration
		{

		public void paint(Graphics graphics)
		{
		graphics.setBackgroundColor( Color.YELLOW);
		graphics.clear();

		subpaint(graphics);
		this.invalidate();

		}

		public Registration(MyUiClass Uiapp)
		{

			super(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT | Field.FIELD_LEFT
			| Field.FIELD_TOP |Manager.VERTICAL_SCROLL |Manager.HORIZONTAL_SCROLL);

			this.Uiapp = app;
			LabelField title = new LabelField("Registration",LabelField.ELLIPSIS |LabelField.USE_ALL_WIDTH| LabelField.FIELD_HCENTER)
			{
			public void paint(Graphics g) {
			g.setBackgroundColor(Color.YELLOW);
			g.clear();

			g.setColor(Color.GREEN);
			super.paint(g);
			invalidate();

							}
			};
		add (title);

			LabelField serverUriLabel = new LabelField("UserName:",
			LabelField.USE_ALL_WIDTH)
			{
			public void paint(Graphics g) {
			g.setBackgroundColor(Color.WHITE);
			g.clear();
			g.setColor(Color.BLACK);
			super.paint(g);
			invalidate();
			}
			};
		add(serverUriLabel);


		RegiPhoneNo = new EditField("", "");
		add(RegiPhoneNo);

			LabelField emailUriLabel = new LabelField("Password:",
			LabelField.USE_ALL_WIDTH) {

			public void paint(Graphics g) {

			g.setBackgroundColor(Color.WHITE);
			g.clear();

			g.setColor(Color.BLACK);
			super.paint(g);
			 invalidate();

			}
			};
		add(emailUriLabel);

		emailPhoneNo = new EditField("", "");
		add(emailPhoneNo);

			LabelField RegistrUriLabel = new LabelField("Name:",
			LabelField.USE_ALL_WIDTH) {

			public void paint(Graphics g) {

			g.setBackgroundColor(Color.WHITE);
			g.clear();

			g.setColor(Color.BLACK);
			super.paint(g);
			invalidate();

			}
			};
		add(RegistrUriLabel);


		Registrationkey = new EditField("", "")
		add(Registrationkey);



			LabelField emailUriLabel2 = new LabelField("Email:",
			LabelField.USE_ALL_WIDTH) {

			public void paint(Graphics g) {
			g.setBackgroundColor(Color.WHITE);
			g.clear();
			g.setColor(Color.BLACK);
			super.paint(g);
			invalidate();

			}
			};
		add(emailUriLabel2);

		emailPhoneNo2 = new EditField("", "") ;
		add(emailPhoneNo2);

		Uiapp.pushScreen(this);
		}

		}

 

 

 

 

 

Please use plain text.
Developer
karan127
Posts: 101
Registered: ‎07-20-2009
My Device: Not Specified

Re: Problem of scrolling in paint (MainScreen)

Hi Ganesh,

 

I am also a newbie in Blackberry development. But in your code you have given a call to invalidate from the paint method. AFAIK, invalidate method again gives a call to paint method.

 

May be your problem is because of this reason. Not sure though...:smileyhappy:

Please use plain text.
New Developer
ganeshS
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Problem of scrolling in paint (MainScreen)

Hello Karan,

 

Thank you for your sugesstion. I will give it a try. And one more thing, I am also new in BB.

So, I am also in learning phase.

:smileyhappy:

 

 

 

Thank you

 

 

 

Please use plain text.
New Developer
ganeshS
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Problem of scrolling in paint (MainScreen)

Hello Karan,

 

I had given it a try but it is not working.Let me know if any other sugesstion.

 

 

 

 

Thank you

Please use plain text.
New Developer
ganeshS
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Problem of scrolling in paint (MainScreen)

Hello Friends,

 

 

Please suggest me some breakthrough for this problem

 

Thank you

 

Please use plain text.