Component List () only works with long pressure

16 views
Skip to first unread message

rdvg...@gmail.com

unread,
Oct 23, 2018, 12:21:44 PM10/23/18
to CodenameOne Discussions
Hi,

Inside my app I use this component and so far I had no problems. Suddenly it only works when a record is pressed for a long time. The truth I have not made changes on this part of the code and I do not understand what happened until Monday worked well. Out of curiosity validate the date of the last update of the plugin codename one and found that it was on Tuesday at 10 pm (in my country).

As a discard change the logic (as shown in the code) denying the condition (isLongEvent) to do the opposite and the correct methods were executed without problems.

        lsLista.addActionListener((ActionListener) (ActionEvent ae) -> {
            if (!ae.isLongEvent()) {
                if (tipo.equals(COMPRA)) {
                    formaProcesarListaCompras(fmLiber, lsLista);
                } else {
                    formaDecideListaDeseos(fmLiber, lsLista);
                }
            } else {
                if (tipo.equals(COMPRA)) {
                    Compra1 cR1 = (Compra1) lsLista.getModel().getItemAt(lsLista.getModel().getSelectedIndex());
                    ArrayList aCompra2 = corrigeCompra2(dT.leeArrayListDatos(cR1.getCompra(), COMPRA2_LEE_FILTRO_COMPRA));
                    formaListaDeseosListaCompra2(fmLiber, cR1, aCompra2, COMPRA);
                } else {
                    Compra1 cR1 = (Compra1) lsLista.getModel().getItemAt(lsLista.getModel().getSelectedIndex());
                    ArrayList aLista2 = corrigeLista2(dT.leeArrayListDatos(cR1.getCompra(), LISTA2_LEE_FILTRO_LISTA));
                    formaListaDeseosListaCompra2(fmLiber, cR1, aLista2, LISTA);
                }
            }
        });

Given that I can not find the problem, I dare to ask if within the last update there was a change that affects this component?

regards

Shai Almog

unread,
Oct 24, 2018, 12:10:08 AM10/24/18
to CodenameOne Discussions
Hi,
let me stress this again. Don't use list. Seriously. Don't. https://www.codenameone.com/blog/avoiding-lists.html

But if you must insist then long press actually doesn't work with lists. There is a separate long press action listener and you should use that. All presses on the list action listener are short presses.
Reply all
Reply to author
Forward
0 new messages