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

New Developer
Posts: 12
Registered: ‎09-23-2008
My Device: Dev Alpha B
My Carrier: Telcel

FieldManager print issue

I have an issue with a class which extends net.rim.devce.api.ui.manager class,  I´m  adding some customs fields to the manager class I create, but I have an print issue with both the first and the last element, my manager class is like a horizontalfieldmanager, if the focus is in the last element of the manager and I move to the left, there is no more field to show by the manager, but the manager doesn´t print the last element if I press more than one time to the left, it prints a white square, which has the same size of the element, but it is not printing the field, this issue is only present when I extends from the one of the folloeing classes manager, verticalfieldmanager or horizontalfieldmanager, when I create an instance from one of those classes and add the elements, there is no problem at the time of printing the fields. so can anyone help me to solve this issue.


Thanks in advance. 

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: FieldManager print issue

Just to clarify, can you confirm that you have a problem when you use your own custom manager, but not with the Standard managers?


If so, then I think we need to see that code.

New Developer
Posts: 12
Registered: ‎09-23-2008
My Device: Dev Alpha B
My Carrier: Telcel

Re: FieldManager print issue

Yes peter, it´s my own implementation the one with the problems this is the code I´m using



public class Tablero extends Manager
    private UiApplication app = null;
    private int managerHeight = 0;
    private int managerWidth = 0;
    private int imageHeight = 0;
    private int imageWidth = 0;
    private int imageHeightLoteria = 0;
    private int imageWidthLoteria = 0;
    private int indexFocus = 0; // take values from 0 to 2 
    private Bitmap image = null;
    private Bitmap imageLoteria = null;
    private CustomButtonField loteria = null;
    private CustomButtonField c0 = null;
    private CustomButtonField c1 = null;
    private CustomButtonField c2 = null;

    // valore x,y de cada elemento
    // estos valores se modifican dependiendo del tamaño de la pantalla
    // y posición de la tabla de la loteria
    private int[][]  usuarioXY = {{43,20,   90,20,  138,20, 185,20},
                                  {43,90,   90,90,  138,90, 185,90},
                                  {43,160,  90,160, 138,160,    185,160},
                                  {43,231,  90,231, 138,231,    185,231}};
    public Tablero(UiApplication app, int width, int height)
        this.app = app;
        this.managerWidth = width;
        this.managerHeight = height;
    private void init()
        // imagen
            this.image = Bitmap.getBitmapResource("imagenes/otros/marco_chico_on.png");
            this.imageLoteria = Bitmap.getBitmapResource("imagenes/otros/boton-loteria-on.png");
        }catch(Throwable t){
        if(this.image != null)
            this.imageHeight = this.image.getHeight();
            this.imageWidth = this.image.getWidth();
        if(this.imageLoteria != null)
            this.imageWidthLoteria = this.imageLoteria.getWidth();
            this.imageHeightLoteria = this.imageLoteria.getHeight();
        // creamos bonotes
        this.c0 = new CustomButtonField("imagenes/otros/marco_chico_on.png",
        this.c1 = new CustomButtonField("imagenes/otros/marco_chico_on.png",
        this.c2 = new CustomButtonField("imagenes/otros/marco_chico_on.png",

        // creamos boton loteria
        this.loteria = new CustomButtonField("imagenes/otros/boton-loteria-on.png",
        // agregamos botones al manager

    protected void sublayout(int width, int height) 
        // pintamos botones en el manager
        this.layoutChild(this.c0, this.imageWidth, this.imageHeight);
        this.layoutChild(this.c1, this.imageWidth, this.imageHeight);
        this.layoutChild(this.c2, this.imageWidth, this.imageHeight);

        this.layoutChild(this.loteria, this.imageWidthLoteria, this.imageHeightLoteria);
        // posición de los elementos
        this.setPositionChild(this.c0, this.usuarioXY[0][0], this.usuarioXY[0][1]);
        this.setPositionChild(this.c1, this.usuarioXY[0][2], this.usuarioXY[0][3]);
        this.setPositionChild(this.c2, this.usuarioXY[0][4], this.usuarioXY[0][5]);

        this.setPositionChild(this.loteria, 77, 309);
        // tamaño del manager fijo
        this.setExtent(this.getPreferredWidth(), this.getPreferredHeight());    

    protected void paint(Graphics g)
    public int getPreferredHeight()
        return this.managerHeight;
    public int getPreferredWidth()
        return this.managerWidth;
    protected boolean navigationMovement(int dx, int dy, int status, int time)
      // here I implement the move in the fields,
	  // I remove this code since it´s to long
        return true;



this is just a part of the code, since the full code is too large, I just put 3 elements inside the manager in order to describe the methods I´m implementing.


hope it can help to understand .