BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 03-17-2009, 05:59 PM   #1 (permalink)
New Member
Join Date: Jan 2009
Model: 7100T
Carrier: Rogers
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default VerticalFieldManager hides part of field when scrolling

Please Login to Remove!


I have a main VFM and a CustomFieldManager, where the CustomFieldManager (CFM) extends a VFM and has a height and width of 50. Creating 5 CFM's and adding them to the main VFM allows me to scroll and select each CFM but when i get past the height of the screen, (so at the 5th CFM), only part of it is displayed. Meaning that only a few pixels are displayed instead of the entire 50. I have to keep scrolling for the entire 50 to be displayed. However i know this field is in focus as i have the focused fields colored. So basically i'm trying to get the entire field to show as i scroll down. I guess I didn't explain this too well so here's the code. This is my first time posting so sorry if the format pasting the code gets messed!

Here's the code for the CustomFieldManager:

public class ThumbnailFieldManager extends VerticalFieldManager implements IntegerConstants {
	private int numRows;
	private int style;
	private int managerHeight;
	private int columns = 1;
	public ThumbnailFieldManager(int _numRows, long _style) {
		//style = _style;
		numRows = _numRows;		
		managerHeight = (getPreferredHeight() * numRows);
	protected void sublayout(int width, int height) {
		Field field;
		int x = 0;
		int y = 0;
		for (int i = 0; i < getFieldCount(); i++) {

			field = getField(i);
			layoutChild(field, width, getPreferredHeight());
			long fieldStyle = field.getStyle();
			int fieldXOffset = 0;
			long fieldHalign = fieldStyle & Field.FIELD_HALIGN_MASK;
			if (fieldHalign == Field.FIELD_RIGHT) {
				fieldXOffset = THUMBNAIL_WIDTH - field.getWidth();
			else if (fieldHalign == Field.FIELD_HCENTER) {
				fieldXOffset = ((THUMBNAIL_WIDTH-field.getWidth())/2); 
			int fieldYOffset = 0;
			long fieldValign = fieldStyle & Field.FIELD_VALIGN_MASK;
			if (fieldValign == field.FIELD_BOTTOM) {
				fieldYOffset = HEADLINE_HEIGHT - field.getHeight();
			else if (fieldValign == Field.FIELD_VCENTER) {
				fieldYOffset = ((HEADLINE_HEIGHT/2) - ((field.getHeight())/2));
			setPositionChild(field, x+fieldXOffset, y+fieldYOffset);

			y += getPreferredHeight();
		setExtent(THUMBNAIL_WIDTH, managerHeight);
	public int getPreferredWidth() {
	public int getPreferredHeight() {
    protected void onUnfocus() {

    public boolean isFocusable() {
    	return true;
    protected void drawFocus(Graphics graphics, boolean on) {
        // Don't draw the default focus

    protected void onFocus(int direction) {
	public void paintBackground( Graphics g ) {
        int color = g.getColor();
        g.setColor( Color.BLACK );
        g.fillRect( 0, 0, THUMBNAIL_WIDTH, managerHeight);
        g.setColor( color );
	public void paint(Graphics g)
		if (this.isFocus()) {
		} else {
And here's the code for the screen that implements a VFM and adds the CFM:

class HeadlinesScreen extends MainScreen implements IntegerConstants {
	private ThumbnailFieldManager thumbnails;
	private VerticalFieldManager vfm;
	HeadlinesScreen() {
		VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Field.FOCUSABLE);
		vfm.add(new LabelField("testXX"));
		LabelField lf[] = {new LabelField("1", Field.FIELD_VCENTER | Field.FIELD_HCENTER), new LabelField("2"), new LabelField("3", Field.FOCUSABLE | Field.FIELD_VCENTER | Field.FIELD_HCENTER), new LabelField("4"), new LabelField("5testtttt")};
		for(int i = 0; i < 5; i++) {
			thumbnails = new ThumbnailFieldManager(1, 0);
			vfm.add(new SeparatorField());
		vfm.add(new LabelField("testYY"));

What am i doing wrong??

Thanks in advance,

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

Vintage Small Electric Motor Lot Bodine NSY-12R Robbins Myers
Vintage Small Electric Motor Lot Bodine NSY-12R Robbins Myers  pictureVintage ACRYLIC EXIT SIGN PANEL; RED on WHITE Translucent; 10" x 7" x 0.125"
Vintage ACRYLIC EXIT SIGN PANEL; RED on WHITE Translucent; 10Vintage Swingline Paper Trimmer / Cutter Guillotine 17" Cut Length
Vintage Swingline Paper Trimmer / Cutter Guillotine 17Vintage Littlestown No. 52 Howe & Fory Pipe Vise - Green Paint - Clean - LQQK
Vintage Littlestown No. 52 Howe & Fory Pipe Vise - Green Paint - Clean - LQQK pictureVTG Dictation Disc DDC Shorthand Speed Development 45RPM RECORDS Set 41 60,70,80
VTG Dictation Disc DDC Shorthand Speed Development 45RPM RECORDS Set 41 60,70,80 picture

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