Hi,

In another post, Shai explained a trick to allow a complete word to be 
written before launching the reading into the Database. I modified it a bit 
to allow one or several words to be written and the reading to be launched 
when I found a blank space.
I have 4 forms which apply the same principle but only 2 works perfectly, 
the other 2 do not show the list after the blank. To get the list 
displayed, I have to click anywhere in the form and click again on the 
autocompletetextfield.
Carefully review all routines and they are almost identical. I'm baffled 
and I need support to solve this silly situation (my code below).
*Important*: this only happens the first time you write on the component, 
after appearing the list can be rewritten and the list is updated without 
problem.

The following image shows the form that works perfectly by launching the 
list after the blank space.

<https://lh3.googleusercontent.com/-oycLSARQkqg/WqxCIvVOItI/AAAAAAAAANI/E2mcoXPyoLsipfJvmVKKRIND1ynqw7MVACLcBGAs/s1600/CodenameOne%2BScreenshot%2B9.png>


The following images show another form that does not work after the blank 
space and a second image where you click on another point of the form and 
then on the component.

<https://lh3.googleusercontent.com/-jw_eO0ibCeQ/WqxDKTUIeZI/AAAAAAAAANQ/Al3TsypT2087ucywXjlOuE9EaNlyCmuRwCLcBGAs/s1600/CodenameOne%2BScreenshot%2B10.png>
  
<https://lh3.googleusercontent.com/-0VGrNs5PSzs/WqxDPe179aI/AAAAAAAAANU/mKU4Mni3M9gZiThG4VFTZLDQEnoKbGWkQCLcBGAs/s1600/CodenameOne%2BScreenshot%2B11.png>
<https://lh3.googleusercontent.com/-0VGrNs5PSzs/WqxDPe179aI/AAAAAAAAANU/mKU4Mni3M9gZiThG4VFTZLDQEnoKbGWkQCLcBGAs/s1600/CodenameOne%2BScreenshot%2B11.png>

My Code:

        Data data = new Data();
        Container cnArticulos = new Container(BoxLayout.y());
        cnArticulos.setScrollableY(true);

        DefaultListModel lmArticulos = new DefaultListModel();
        AutoCompleteTextField acNombreArticulo = new 
AutoCompleteTextField(lmArticulos) {
            @Override
            protected boolean filter(String text) {
                if (text.length() == 0) {
                    return false;
                }
*                char[] p = text.toCharArray();*
*                if (p.length == 0) {*
*                    return false;*
*                } else **if (p[p.length - 1] != ' ') {*
*                        return false;*
*                    }*
*                }*
                ArrayList l = dT.leeInformacionRegistro(text, 
ARTICULO_LEE_NOMBRE_REGISTRO);
                if (l == null || l.isEmpty()) {
                    return false;
                }
                if (l.size() < LIMITE_DATOS) {
                    Vector vArticulos = new Vector();
                    lmArticulos.removeAll();
                    for (int i = 0; i < l.size(); i++) {
                        Articulo aRt = registroArticulo((Map<String, 
String>) l.get(i));
                        lmArticulos.addItem(aRt.getNombre());
                        vArticulos.addElement(aRt);
                    }
                    data.setArticulos(vArticulos);
                    Vector vArticuloEvaluacion = new Vector();
                    l = dT.leeInformacionRegistro(text, 
ARTICULO_EVALUACION_LEE_FILTRO_ARTICULO);
                    if (l != null) {
                        for (int i = 0; i < l.size(); i++) {
                            ArticuloEvaluacion aEv = 
registroArticuloEvaluacion((Map<String, String>) l.get(i));
                            vArticuloEvaluacion.addElement(aEv);
                        }
                    }
                    data.getArticuloEvaluacion();
                } else {
                    Dialog.show(idioma.getInformacion(), 
idioma.getMensaje21(), idioma.getContinuar(), null);
                }
                return true;
            }
        };






-- 
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/04c6e7ee-e9a6-4dcc-8b39-7d394fdee069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to