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
Posts: 38
Registered: ‎10-07-2009
My Device: Not Specified
Accepted Solution

how to make half of screen no scrollable and other half part of screen scrollable

Hi all 

 

I am new in BB please help me out regarding this issue. 

 

 Right now the problem which I am facing is how to make the left part of screen fixed. Right now I wanted to show the list of n records at the right side of screen and wanted to show three buttons at the left side of screen. when any user is going to scroll the screen to view the records I want buttons remain fixed at the left side of screen(No_Vertical_Scroll). 

 

Right now i am creating one HorizontalFieldManager  in which there are two verticalFieldManager so I be able to split the screen.

 

I have made the leftVerticalManager No_Vertical_Scroll and rightVerticalManager as VERTICAL_SCROLL  but when I scroll the screen both part started to scroll so the buttons at the left side move up not remain fixed.

 

thanks in advance 

Developer
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: how to make half of screen no scrollable and other half part of screen scrollable

Try creating a vertical field manager with two horizontal field managers.  One of the HFM should be no scroll.
New Developer
Posts: 38
Registered: ‎10-07-2009
My Device: Not Specified

Re: how to make half of screen no scrollable and other half part of screen scrollable

Thanks for the quick reply but problem is 

 

if we make one vertical field manager and two horizontal field manager in this we are dealing the records in the rows like this 

 

 

----------------------------------------------                                             -------------------------------------------

|first hrm                                 |                                             |             |                           |up

|first hrm1                               |                                             |  button1| records1              |

----------------------------------------------                                             ------------------------------------------|

|second hrm                            |                        but I want       |  button2| record2               |

----------------------------------------------                                             |             |                           |

|                                            |                                             ------------------------------------------|

|                                            |                                             | button3  |  record3             |

|                                            |                                             |              |                          |down

                                                                                           ------------------------------------------

 

 

 

Highlighted
Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: how to make half of screen no scrollable and other half part of screen scrollable

I think

 

you may set the main screen is not scrollable first

 

add a verticalFieldManager with fixed height as half screen , also set to scrollable

 

then add a verticalFieldManger to set to scrollable

 

may be it should work 

New Developer
Posts: 38
Registered: ‎10-07-2009
My Device: Not Specified

Re: how to make half of screen no scrollable and other half part of screen scrollable

thanks eidtormax

 

problem solved!

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: how to make half of screen no scrollable and other half part of screen scrollable

how did you got the solution to your problem can u post the code please since i am stuck in the same issue?

Swapnil G.
New Developer
Posts: 38
Registered: ‎10-07-2009
My Device: Not Specified

Re: how to make half of screen no scrollable and other half part of screen scrollable

hi Swapnil Hope this will solve your issue.

 

 

first of all in constructor 

 

write this super(Manager.NO_VERTICAL_SCROLL); at very first line. This line will make screen non scrollable.

 

Now make one Horizonal manager like 

 

HorManager = new HorizontalFieldManager(FOCUSABLE)   this line will make the screen moveable within specified reign.

 

 

Now make two vertical field manager. one with name right screen manager and other left screen manager 

 

for left screen make it like 

 

 

leftScreen = new VerticalFieldManager(Manager.FIELD_VCENTER | Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLLBAR
| Manager.NO_VERTICAL_SCROLL

 

leftScreen = new VerticalFieldManager( Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_VERTICAL_SCROLL) 

 

this command will make left part of screen non scrollable

 

 

for right screen manager

 

 

rightscreen = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | FOCUSABLE | USE_ALL_WIDTH | USE_ALL_HEIGHT)

 

this will make the right screen scrollable 

 

 

 

 

this is how i solved my problem

 

Inshallah that will help you in your issue too.

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: how to make half of screen no scrollable and other half part of screen scrollable

i am having the opposite requirments as yours is? i want the upper part as static and the lower part should only scroll. anyhow i am not able to get this? if you could provide some code would be of great help to me?

 

i had posted the same question in this forum and tried all the suggestions given by the devlopers but still problem remains the same?

Swapnil G.
New Developer
Posts: 38
Registered: ‎10-07-2009
My Device: Not Specified

Re: how to make half of screen no scrollable and other half part of screen scrollable

I have also solved this issue

 

 

for this

 

write super(Manager.NO_VERTICAL_SCROLL); in constructor

 

First make vertical field manager like

 

 

 

vertOrHorManager = new VerticalFieldManager(Field.FOCUSABLE) 
{
protected void paintBackground(Graphics arg0) 
{
arg0.setColor(Constants.COLOR_OPP_TITLE_ODD);
arg0.setBackgroundColor(Constants.COLOR_OPP_TITLE_ODD);
arg0.clear();
}
};

 

vertOrHorManager = new VerticalFieldManager(Field.FOCUSABLE) 

 {

        protected void paintBackground(Graphics arg0)

      {

  arg0.setColor(colorvalue);

      arg0.setBackgroundColor(colorvalue); arg0.clear();

  }

}; 

 

 

make upper screen

 

 

 

upperScreen = new HorizontalFieldManager(Manager.FIELD_HCENTER | Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_VERTICAL_SCROLL | Manager.USE_ALL_WIDTH) 

{

protected void sublayout(int maxWidth, int maxHeight) 

{

super.sublayout(maxWidth, maxHeight);

}

protected void paintBackground(Graphics arg0) 

{

arg0.setColor(Color.BLACK);

arg0.setBackgroundColor(Color.BLACK);

arg0.clear();

super.paintBackground(arg0);

}

};

 

 

lowerScreen

 

 

HorizontalFieldManager hfm2 = new HorizontalFieldManager(FOCUSABLE);

 

 

 

 

lowerscreen = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | FOCUSABLE | USE_ALL_WIDTH | USE_ALL_HEIGHT)

{

protected void onFocus(int direction) 

{

super.onFocus(direction);

}

protected void paintBackground(Graphics arg0) 

{

arg0.setColor(colorvalue);

arg0.setBackgroundColor(colorvalue);

arg0.clear();

}

};

 

 

hfm2.add(lowerscreen);

 

 

vertOrHorManager.add(upperScreen );

vertOrHorManager.add(hfm2);

 

 

hope this solve your problem 

 

 

 

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: how to make half of screen no scrollable and other half part of screen scrollable

public HalfScrollPSScreen()
	{
		super(Manager.NO_VERTICAL_SCROLL);
		this.add(new LabelField("Swapnil"));
		
		vertOrHorManager = new VerticalFieldManager(Field.FOCUSABLE)
		 {
		  
			protected void paintBackground(Graphics arg0)
		    {
				int colorvalue = 0x003F87;
				arg0.setColor(colorvalue); 
				arg0.setBackgroundColor(colorvalue); 
//				arg0.clear();
		    }
			public void invalidate()
			{			
				super.invalidate();
			}
		}; 	 

		 
		upperScreen.add(new LabelField("swapnil"));

		// Upper Part of the Screen
		upperScreen = new HorizontalFieldManager(Manager.FIELD_HCENTER | Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_VERTICAL_SCROLL | Manager.USE_ALL_WIDTH) 
		{
			protected void sublayout(int maxWidth, int maxHeight)
			{
				super.sublayout(maxWidth, maxHeight);
			}
			
			protected void paintBackground(Graphics graphics) 
			{
				super.paintBackground(graphics);
				graphics.setColor(Color.BLACK);
				graphics.setBackgroundColor(Color.BLACK);
//				graphics.clear();
			}
			public void invalidate()
			{			
				super.invalidate();
			}
			public void add(Field field)
			{			
				super.add(field);
			}
		};
		

		//	Lower Part of the Screen		 

		HorizontalFieldManager hfm2 = new HorizontalFieldManager(FOCUSABLE);
		lowerscreen = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | FOCUSABLE | USE_ALL_WIDTH | USE_ALL_HEIGHT)
		{
			protected void onFocus(int direction) 
			{
				super.onFocus(direction);
			}
			protected void paintBackground(Graphics arg0) 
			{
				int colorvalue = 0x003F87;
				arg0.setColor(0x003F87);
				arg0.setBackgroundColor(0x003F87);
//				arg0.clear();
			}
			protected void sublayout(int maxWidth, int maxHeight)
			{			
				super.sublayout(maxWidth, maxHeight);
			}
			public void invalidate()
			{			
				super.invalidate();
			}
			
		};
			hfm2.add(lowerscreen);
			vertOrHorManager.add(upperScreen );
			vertOrHorManager.add(hfm2);	
			
			this.add(vertOrHorManager);	
			
		}
	public void invalidate()
	{	
		super.invalidate();
	}

 

this is what every thing you have suggested didn't work for me? it is simply showing a white screen.

Swapnil G.