Hi,

In my application I use the tab component with 3 tabs. In tab # 1 I show a 
list (see figure 1) and when selecting a record I have the opportunity to 
create information for tab 2 (see figure 2 and 3). ¨ For each tab I have a 
container that I load with the methods "muestraLista1" (tab1) and 
"muestraCompra1" (tab2).

For some reason the list on tab 2 is not displayed (see figure 4). Then I 
run a test by creating a test form by moving the container that generates 
the "muestraCompra1" method. To my surprise the form shows the list.

I tried using the addSelectionListener on the tab to force the container to 
load when tab 2 is selected but I get nothing.

*Question: How do I make the second tab show the list?*

My Code:
    // Método que muestra la  Forma Principal
    private void muestraLiber() {

        final Form fmLiber = new Form();
        fmLiber.setTitle(Constantes.APLICACION);
        fmLiber.setLayout(new BorderLayout());


        final Toolbar tbMenu = new Toolbar();
        fmLiber.setToolBar(tbMenu);
        Style s = UIManager.getInstance().getComponentStyle("Title");
        FontImage iSincronizar = 
FontImage.createMaterial(FontImage.MATERIAL_CACHED, s);

        Command cmdInventario = new Command(idioma.getMensaje23()) {
            public void actionPerformed(ActionEvent ev) {
                muestraInventario(fmLiber);
            }
        };
        Command cmdValidacion = new Command(idioma.getValidar()) {
            public void actionPerformed(ActionEvent ev) {
              *  muestraPrueba(fmLiber);*
            }
        };
        tbMenu.addCommandToOverflowMenu(cmdValidacion);
        menuLateral(fmLiber);

        cnLiber1 = muestraLista1(fmLiber);
*        cnLiber2 = muestraCompra1(fmLiber);*
        cnLiber3 = new Container();

        final Tabs tsMenu = new Tabs();
        tsMenu.addTab(idioma.getListas(), null, cnLiber1);
        tsMenu.addTab(idioma.getCompras(), null, cnLiber2);
        tsMenu.addTab(idioma.getNovedades(), null, cnLiber3);

        tsMenu.addSelectionListener(new SelectionListener() {
            @Override
            public void selectionChanged(int oldSelected, int newSelected) {
                if (newSelected == 2) {
                    cnLiber2 = muestraCompra1(fmLiber);
                    fmLiber.forceRevalidate();
                }
            }

        });
        fmLiber.addComponent(BorderLayout.CENTER, tsMenu);
        fmLiber.addComponent(BorderLayout.SOUTH, banner);
        fmLiber.setBackCommand(cmdSalir);
        
fmLiber.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL,
 
true, 500));
        fmLiber.revalidate();
        fmLiber.show();
    }


    // Método que muestra que devuelve un contenedor con la información de 
las Compras1
    private Container muestraCompra1(final Form fmLiber) {

        Container cn = new Container(new BorderLayout());
        final List compra1 = new List();
        compra1.setUIID("Form");

        Vector vCompra1 = dT.getCompra1();
        ListModel lmCompra1 = new DefaultListModel(vCompra1);
        final FilterProxyListModel proxyModel = new 
FilterProxyListModel(lmCompra1);
        compra1.setModel(proxyModel);
        compra1.setListCellRenderer(new 
FormatoLista1(Constantes.LISTA_COMPRA1));
        compra1.setSmoothScrolling(true);

        compra1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                if (ae.isLongEvent()) {
                    actualizaCompra1(fmLiber, compra1);
                } else {
                    muestraCompra2((Compra1) 
compra1.getModel().getItemAt(compra1.getModel().getSelectedIndex()), 
fmLiber);
                }
            }
        });;
        cn.addComponent(BorderLayout.CENTER, compra1);
        return cn;
    }

   * private void muestraPrueba(final Form fmLiber) {*
        final Form fmPrueba = new Form();
        fmPrueba.setLayout(new BorderLayout());
        fmPrueba.setScrollable(false);
        
        
        Command cmdVolver = new Command(idioma.getVolver()) {
            public void actionPerformed(ActionEvent ev) {
                fmLiber.showBack();
            }
        };
        Container cn2 = muestraCompra1(fmLiber);
        fmPrueba.addComponent(BorderLayout.CENTER, cn2);
        fmPrueba.setBackCommand(cmdVolver);
        fmPrueba.setTransitionOutAnimator(CommonTransitions.createSlide(
                CommonTransitions.SLIDE_HORIZONTAL, true, 500));
        fmPrueba.show();
    }

<https://lh3.googleusercontent.com/-ZW4TwxnzMX4/WDxrRLGEakI/AAAAAAAAAJA/dmVt75J4ZMsYorHwnu4zGRiH4zpgTpkZgCLcB/s1600/CodenameOne%2BScreenshot%2B42.png>
 
<https://lh3.googleusercontent.com/-o73F_2Yd_ts/WDxrdPkaxXI/AAAAAAAAAJI/1eqVJHat8xcaEfP5ldXt0mPA-m_XKgCHQCLcB/s1600/CodenameOne%2BScreenshot%2B44.png>
 
<https://lh3.googleusercontent.com/-HWZlynm5Ays/WDxrLfWbtCI/AAAAAAAAAI8/v6efBFunVaMSc6mrTtUtWqSy9INdVbAUQCLcB/s1600/CodenameOne%2BScreenshot%2B36.png>
   
<https://lh3.googleusercontent.com/-InFi_ISMXHE/WDxrXe5_fnI/AAAAAAAAAJE/S36ETVUXZqE3u9CYfIPAx8qh9_6rEKpZwCLcB/s1600/CodenameOne%2BScreenshot%2B43.png>
 







 

    
<https://lh3.googleusercontent.com/-bJW-F2XpQyg/WDxoIbBrtVI/AAAAAAAAAIg/uWyC9VfwVKsd5zCzYOsCNWUsgXVhTZ9SQCLcB/s1600/CodenameOne%2BScreenshot%2B36.png>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/03a64242-6f3e-4e2f-a74b-8a3e89ee729d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to