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
Trusted Contributor
swapnil_gadkari
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
Accepted Solution

scroll issue for part of screen

2309i22B7599959E90B9B

hi all,

       i want to make the upper part as static and the lower part should get scroll. i have written something like this still the entire screen gets scrolled.

 

//the header manager which needs to be static
HeaderManager headermanager = new HeaderManager(Manager.NO_VERTICAL_SCROLL);		

//the footer manager which needs to get scrolled		
AddProductDetails addProductDetails = new AddProductDetails(VERTICAL_SCROLLBAR);

//adding the header and footer manager
PlaceComponents manager = new PlaceComponents(NO_VERTICAL_SCROLLBAR);
manager.add(headermanager);
manager.add(addProductDetails);

(Note: the three managers (header,footer,layout) are the custom).

 

how can i achieve this? plz help me.

 

Swapnil G.
Developer
packiaraj
Posts: 231
Registered: ‎07-09-2009
My Device: Not Specified

Re: scroll issue for part of screen

[ Edited ]

Hi Swapnil G,

 

Please try this ana let me know...

 

Use below custom class..

 

 

final class ContentManager extends VerticalFieldManager
{
    private int thisRowBGColor = Color.WHITE;
    public ContentManager()
    {
        super( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR | Manager.USE_ALL_HEIGHT | Manager.USE_ALL_WIDTH);
    }
    public ContentManager(long style)
    {
        super( style);
    }
    public ContentManager(long style,String page)
    {
        super( style);
        thisRowBGColor = 0xCEDAF2; 
    }
   
    public void paint(Graphics graphics) {
        graphics.clear();   
        graphics.setColor(thisRowBGColor);         
        graphics.fillRect(0,0, Display.getWidth()+100, (Display.getHeight()));        
        super.paint(graphics);
    }
    
};

final class InnerContentManager extends VerticalFieldManager
{
    int thisRowBGColor = Color.WHITE;
    public InnerContentManager()
    {
        super( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Manager.USE_ALL_HEIGHT | Manager.USE_ALL_WIDTH | DrawStyle.HCENTER | Field.FIELD_HCENTER);
    }
    public InnerContentManager(long style)
    {
        super( style);
    }
    public InnerContentManager(long style,String page)
    {
        super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Manager.USE_ALL_HEIGHT | Manager.USE_ALL_WIDTH | DrawStyle.HCENTER | Field.FIELD_HCENTER | style);
        thisRowBGColor = 0xCEDAF2; 
    }
    public void paint(Graphics graphics) {
        graphics.clear();   
        graphics.setColor(thisRowBGColor);         
        graphics.fillRect(0,0, Display.getWidth(), (Display.getHeight()*Display.getHeight()));        
        super.paint(graphics);
    }
};

 

then u can call like this..

/* add your non-scrollable field example */

add(new LabelField("First"));
add(new LabelField("Second"));

...

inCntMgr.add(new LabelField("Scroll"));
cntMgr.add(inCntMgr);

add(cntMgr);

 

 

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

Please mark this thread as solved if u got solution..

 

Thanks,

Packiaraj M

 

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

Re: scroll issue for part of screen

[ Edited ]

i tried as you suggested but it is scrolling the entire screen.

 

here is the main i have written.

InnerContentManager inCntMgr = new InnerContentManager(NO_VERTICAL_SCROLL,"swapnil gadkari");
ContentManager cntMgr = new ContentManager();
		
add(new LabelField("First"));
add(new LabelField("Second"));

inCntMgr.add(new LabelField("Scroll"));
cntMgr.add(inCntMgr);

add(cntMgr);

 2310i6F015D34BE51EBFC

i want that the first second labelfield should not get scroll and rest screen must but it is scrolling the entire screen.

Swapnil G.
Regular Contributor
vedernikov
Posts: 67
Registered: ‎09-30-2009
My Device: Not Specified

Re: scroll issue for part of screen

If you're using the MainScreen you could use the setTitle(Field field) method for the "static" part.

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

Re: scroll issue for part of screen

this would not work for me perfectly

Swapnil G.
Regular Contributor
vedernikov
Posts: 67
Registered: ‎09-30-2009
My Device: Not Specified

Re: scroll issue for part of screen

hm... why?

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: scroll issue for part of screen

[ Edited ]

A few things to make sure:

1.  Your Screen (which probably extends MainScreen) to which you add your PlaceComponents manager as well as your PlaceComponents manager both should not be scrollable.  Make sure you call them with NO_VERTICAL_SCROLL style or invoke super(NO_VERTICAL_SCROLL) in their constructor.  Then your other managers will get only as much as there is room on the screen and will be aware of the constraints.  Otherwise your AddProductDetails manager will get virtually unlimited height during layout() and will decide that it does not need to scroll.

 

2. Your AddProductDetails manager, on the other hand, has to be scrollable.  Check the manager it extends and see if VERTICAL_SCROLL is the default there.  If it is not, add VERTICAL_SCROLL to your new AddProductDetails().

 

Your "the entire screen gets scrolled" remark proves that you need to take care of your MainScreen and PlaceComponents manager first.  The latter can be done like this:

 

//the header manager which needs to be static
HeaderManager headermanager = new HeaderManager(Manager.NO_VERTICAL_SCROLL);		

//the footer manager which needs to get scrolled		
AddProductDetails addProductDetails = new AddProductDetails(VERTICAL_SCROLLBAR);

//adding the header and footer manager
PlaceComponents manager = new PlaceComponents(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
manager.add(headermanager);
manager.add(addProductDetails);

(Note: the three managers (header,footer,layout) are the custom).
----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Trusted Contributor
swapnil_gadkari
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

Re: scroll issue for part of screen

hi ,

 the settitle(Field field) is not possible as it is setting the title but in the other half part the entire screen is  shown as black. also i tried with custom manager but not resolved.

Swapnil G.
Regular Contributor
vedernikov
Posts: 67
Registered: ‎09-30-2009
My Device: Not Specified

Re: scroll issue for part of screen

Does setBanner(Field field) resolve the black background issue for you?

Developer
satchell
Posts: 48
Registered: ‎07-28-2009
My Device: Tour 9630

Re: scroll issue for part of screen

Hi S,

 

Take a look at the wire frame layout demo, I know it comes with 5.0 api for sure.

 

Good Luck,

Brent