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
cristianjss
Posts: 12
Registered: ‎09-23-2008
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. 

Please use plain text.
Developer
peter_strange
Posts: 19,513
Registered: ‎07-14-2008

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.

Please use plain text.
New Developer
cristianjss
Posts: 12
Registered: ‎09-23-2008
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)
    {
        super(0);
        this.app = app;
        this.managerWidth = width;
        this.managerHeight = height;
        this.init();
    }
    
    private void init()
    {
        // imagen
        try{
            this.image = Bitmap.getBitmapResource("imagenes/otros/marco_chico_on.png");
            this.imageLoteria = Bitmap.getBitmapResource("imagenes/otros/boton-loteria-on.png");
        }catch(Throwable t){
            t.printStackTrace();
        }
        
        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",
                                                 "imagenes/otros/marco_chico_off.png");
        this.c1 = new CustomButtonField("imagenes/otros/marco_chico_on.png",
                                                 "imagenes/otros/marco_chico_off.png");
        this.c2 = new CustomButtonField("imagenes/otros/marco_chico_on.png",
                                                 "imagenes/otros/marco_chico_off.png");

                                                 
        // creamos boton loteria
        this.loteria = new CustomButtonField("imagenes/otros/boton-loteria-on.png",
                                                 "imagenes/otros/boton-loteria.png");
        
        // agregamos botones al manager
        this.add(this.c0);
        this.add(this.c1);
        this.add(this.c2);
        
        this.add(this.loteria);
        
    }

    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)
    {
        super.paint(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 .

 

thanks

Please use plain text.