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
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified
Accepted Solution

problem with the arrows

Hi, I have a problem. In a screen of my application are the arrows to move up and down the screen when the elements within it are smaller than the screen height (I use the simulator 9000 bold). I wonder how I can avoid arrows to appear when the display screen is smaller, what can I do? this is my code and the screen:
arrow.JPG
public class HojaInformativaPersContacScreen extends CustomScreen implements Observable{
	
	CRMBBController controller;
	
	private RoundRectVerticalManager manager;
	
	private RoundRectContainer cabecera;
	private RoundRectContainer contPersContac;

	private CustomListField participantesList;
	private ListCallback participantesCallback;
	
	private ButtonField buttonPersContac;
	private LabelField labelPersContac;
	
	ResourceBundle resources = ResourceBundle.getBundle(CRMBBLangResource.BUNDLE_ID, CRMBBLangResource.BUNDLE_NAME);
	
	
	public HojaInformativaPersContacScreen(CRMBBController controller){ 
		
		this.controller = controller;
		
		ClienteDTO cliente = controller.getClienteActual();
		
		//Cabecera
		addTitle(new LabelField(resources.getString(CRMBBLangResource.HOJA_INFOR) + " / " + resources.getString(CRMBBLangResource.PERS_CONTAC), Field.FIELD_HCENTER));

		manager = new RoundRectVerticalManager();
		

		contPersContac = new RoundRectContainer(Field.NON_FOCUSABLE);
		

		//CONTENEDOR GENERAL
		cabecera = getCabeceraCliente(cliente);
		manager.add(cabecera);
		
		
		//CONTENEDOR PERSONAS DE CONTACTO
		labelPersContac = new LabelField(resources.getString(CRMBBLangResource.PERS_CONTAC));
		labelPersContac.setFont(Fuente.getFuenteBoldSmall());

		
		participantesCallback = new ListCallback();
		participantesList = new CustomListField();
		participantesCallback.setVector(cliente.getPersonasContacto(), participantesList);	
		participantesList.setCallback(participantesCallback);
		
		VerticalFieldManager contVertPersContac = new VerticalFieldManager(Field.NON_FOCUSABLE);
		contVertPersContac.add(labelPersContac);
		contVertPersContac.add(participantesList);
		
		contPersContac = new RoundRectContainer(Field.NON_FOCUSABLE);
		contPersContac.add(contVertPersContac);
		
		if(!this.controller.isOtrosClientes()) {
			buttonPersContac = new ButtonField(resources.getString(CRMBBLangResource.CREAR));
			contPersContac.add(buttonPersContac);
		}
		
		
		manager.add(contPersContac);

	
		//Añadimos al screen
		add(manager);
		
		//fijamos foco
		if(participantesList.isEmpty() && !this.controller.isOtrosClientes())
			buttonPersContac.setFocus();
	}

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: problem with the arrows

Can you format your request and repost, your code is not inserted properly.


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

public class HojaInformativaPersContacScreen extends CustomScreen implements Observable{
	
	CRMBBController controller;
	
	private RoundRectVerticalManager manager;
	
	private RoundRectContainer cabecera;
	private RoundRectContainer contPersContac;

	private CustomListField participantesList;
	private ListCallback participantesCallback;
	
	private ButtonField buttonPersContac;
	private LabelField labelPersContac;
	
	ResourceBundle resources = ResourceBundle.getBundle(CRMBBLangResource.BUNDLE_ID, CRMBBLangResource.BUNDLE_NAME);
	
	
	public HojaInformativaPersContacScreen(CRMBBController controller){ 
		
		this.controller = controller;
		
		ClienteDTO cliente = controller.getClienteActual();
		
		//Cabecera
		addTitle(new LabelField(resources.getString(CRMBBLangResource.HOJA_INFOR) + " / " + resources.getString(CRMBBLangResource.PERS_CONTAC), Field.FIELD_HCENTER));

		manager = new RoundRectVerticalManager();
		

		contPersContac = new RoundRectContainer(Field.NON_FOCUSABLE);
		

		//CONTENEDOR GENERAL
		cabecera = getCabeceraCliente(cliente);
		manager.add(cabecera);
		
		
		//CONTENEDOR PERSONAS DE CONTACTO
		labelPersContac = new LabelField(resources.getString(CRMBBLangResource.PERS_CONTAC));
		labelPersContac.setFont(Fuente.getFuenteBoldSmall());

		
		participantesCallback = new ListCallback();
		participantesList = new CustomListField();
		participantesCallback.setVector(cliente.getPersonasContacto(), participantesList);	
		participantesList.setCallback(participantesCallback);
		
		VerticalFieldManager contVertPersContac = new VerticalFieldManager(Field.NON_FOCUSABLE);
		contVertPersContac.add(labelPersContac);
		contVertPersContac.add(participantesList);
		
		contPersContac = new RoundRectContainer(Field.NON_FOCUSABLE);
		contPersContac.add(contVertPersContac);
		
		if(!this.controller.isOtrosClientes()) {
			buttonPersContac = new ButtonField(resources.getString(CRMBBLangResource.CREAR));
			contPersContac.add(buttonPersContac);
		}
		
		
		manager.add(contPersContac);

	
		//Añadimos al screen
		add(manager);
		
		//fijamos foco
		if(participantesList.isEmpty() && !this.controller.isOtrosClientes())
			buttonPersContac.setFocus();
	}

 

Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

I need help! :No:

Please use plain text.
Developer
tommy20
Posts: 253
Registered: ‎05-18-2011
My Device: Curve 9300, BB10 Dev Alpha C, Z10

Re: problem with the arrows

I see that you are using several custom managers and a custom screen (which you did not post here). So I can only just guess, to avoid the arrows in your case, what you may need to do is to find and remove the style 'USE_ALL_HEIGHT' in all your custom managers and screen.
--tom
Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

thanks tommy20, I also used two VerticalFieldManager to fix it and this it's resolved. Now I have another problem because I can not put the buttons to the middle of the screen, you know what happens? this is my code:

 

 

public class MenuPrincipalScreen extends MainScreen{
    
    private LabelField title;
    private LabelField texto;
    private ButtonField consultaClientes;
    private ButtonField gestionVisitas;
    private ButtonField consultaHistorico;
    private RoundRectVerticalManager manager;
    private BitmapField fondo;
    private CecofarConsultaVisitasController controller;
    private Graphics graphics;
    private static final Bitmap imagenFondo = Bitmap.getBitmapResource("cecofarfondo480x480.jpg");
            
    public MenuPrincipalScreen(CecofarConsultaVisitasController controller){
        
        super(NO_VERTICAL_SCROLL | FIELD_HCENTER);
        
        this.controller = controller;
        
        title = new LabelField("Gestión Comercial: Menú Principal", LabelField.FIELD_HCENTER);
        setTitle(title);
        
        texto = new LabelField("Gestión de visitas", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE);
        fondo = new BitmapField(imagenFondo, BitmapField.FIELD_HCENTER);
        
        consultaClientes = new ButtonField("Consulta de clientes", ButtonField.FIELD_HCENTER);
        gestionVisitas = new ButtonField("Gestión de visitas", ButtonField.FIELD_HCENTER);
        consultaHistorico = new ButtonField("Consulta histórico ventas cliente", ButtonField.FIELD_HCENTER);
        
        //Contenedor con imagen de fondo
        VerticalFieldManager imagenVert = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR | VerticalFieldManager.FIELD_HCENTER){
//                VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT
//                | VerticalFieldManager.FIELD_HCENTER){
            public void paint(Graphics graphics) {
                
                graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(), imagenFondo, 0, 0);
                super.paint(graphics);
            }
        };
        
        //Contenedor con los elementos de la pantalla (botones) a insertar
        VerticalFieldManager componentesVert = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | VerticalFieldManager.FIELD_HCENTER){
            
            protected void sublayout( int maxWidth, int maxHeight ){
                
                int displayWidth = Display.getWidth();
                int displayHeight = Display.getHeight();
 
                super.sublayout( displayWidth, displayHeight);
                setExtent( displayWidth, displayHeight);
            }
        };
        
        //Añadimos elementos a los contenedores
        componentesVert.add(new LabelField(" ", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
        componentesVert.add(new LabelField(" ", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
        componentesVert.add(consultaClientes);
        componentesVert.add(consultaHistorico);
        componentesVert.add(gestionVisitas);
        
        imagenVert.add(componentesVert);
        
        add(imagenVert);      
        
        
        Font f = Util.getNewFont(23, Font.BOLD);
        title.setFont(f);
        consultaClientes.setFont(f);
        consultaHistorico.setFont(f);
        gestionVisitas.setFont(f);
    }

}

Please use plain text.
Developer
tommy20
Posts: 253
Registered: ‎05-18-2011
My Device: Curve 9300, BB10 Dev Alpha C, Z10

Re: problem with the arrows

Normally, for a new question you should open new thread for it.
Anyway, what did you mean by "I can't put the buttons to the screen"?
--tom
Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

Sorry, your are allright. I want say that the buttons do not align in the center of the screen, shown attached to the left (sorry for my poor english).

 


 


Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

ejemploAlineamiento

Please use plain text.
Developer
zaratustraelimp
Posts: 171
Registered: ‎03-04-2009
My Device: Not Specified

Re: problem with the arrows

Solved! The problem resolved with : super(NO_VERTICAL_SCROLL);

Please use plain text.