Skip to main content

Wrong selectedRow returned with touch device

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
andrianiaina
Offline
Joined: 2011-05-18

I want to work with the selected row of a Table when the device is a touch one in the pointerPressed method , and what I get is a wrong value : for example I clicked the third line ( PS : the header line is -1 ) and I got 0 as a value in the System.out.println ! And when I click another row then I get the row I selected before !
So how to synchronize LWUIT with the selected row ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
andrianiaina
Offline
Joined: 2011-05-18

I loop the table components , for (short idxComp=3; idxComp < tList.getComponentCount(); idxComp++) , and I add them focusListener, in the focusGained method I get the selectedRow, and I also execute an action which shows a detail Form based on the selected row. Now my problem is when the table Form is shown (whether for the first time or when navigating back to it from the detail Form ) then the focus is programatically placed at a certain cell of the table : tList.getComponentAt(3*selectedRow+3).requestFocus(); and the action of displaying the detail Form I need to be executed is not executed when I click on this cell ! So how to execute the action in this situation ?