Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Having a List in a Form messes up layout #308

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!

I found the following issue when testing my program on Android phone (HTC 
myTouch 4G) and Simulator.

What steps will reproduce the problem?

1. Create a simple form with a List control in it (use attached example).
2. Click on the first item in the list (index 0) and the selected index will 
change to 1.
3. Click on the second control in the list (index 1) and the selected index 
will change to 2.

What is the expected output? 
 - Selected index should change to whatever item is being selected via click.

What do you see instead?
 - Selected index is 1 greater then the one actually selected.

What version of the product are you using? On what operating system?
 - Latest version of CN1 on Android OS 2.2 and 2.3

I've created a different example with a Label, List, and Button in a form.  The 
problem persists, everything seems to be shifted.  

When testing on a real device I've found that rotating the screen to force a 
layout change will fix the issue.  

Original issue reported on code.google.com by gt88...@gmail.com on 28 Aug 2012 at 5:50

Attachments:

GoogleCodeExporter commented 9 years ago
The problem seems to be related to incorrectly initialized absolute Y.  Any 
workaround until the fix is available will be greatly appreciated.

Original comment by gt88...@gmail.com on 28 Aug 2012 at 5:52

GoogleCodeExporter commented 9 years ago
The workaround is to make the Form scrollable false but it seems to me that the 
first version should still work regardless.
Chen can you look at this?

Original comment by shai.almog on 28 Aug 2012 at 6:49

GoogleCodeExporter commented 9 years ago
I tracked the problem down to the initComponentImpl() method in the List class. 
 It is invoked before the container is layed out while internally it calls to 
List.selectElement() which calls List.scrollRectToVisible() which calls up to 
Component.scrollRectToVisible() which, since component bounds are still zero at 
this point sets scroll Y and everything goes downhill from there.

Original comment by gt88...@gmail.com on 28 Aug 2012 at 7:47

GoogleCodeExporter commented 9 years ago
fixed now, thanks

Original comment by cf27...@gmail.com on 30 Aug 2012 at 7:58