scrollRectToVisible Table component not behaving

7 views
Skip to first unread message

shop.servic...@gmail.com

unread,
Jan 27, 2019, 5:31:03 PM1/27/19
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA NetBeans 8.2
Desktop OS Windows 10 Pro
Simulator Latest
Device PC, Android, IOS

Have a simple table that a Button Action Event calls the following code.

                                Rectangle rect = table.getSelectedRect();
                                table.scrollRectToVisible(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), this);

The Table contains 60+ rows.

Scroll Down and click to select row say 60
Then click the Button to force a scroll and the Page scrolls to the top where 1/2 the top page is blank

See attached pic

In general, I use scrollRectToVisible when the user adds a new row in a large list, we want to scroll to the bottom for example.

Regards.
CodenameoneScrollIssue-01-27-2019.JPG

Shai Almog

unread,
Jan 27, 2019, 10:18:31 PM1/27/19
to CodenameOne Discussions
scrollRectToVisible would work if the rectangle was there. The main problem is that the table is rebuilt from scratch every time you use set model.
In this thread I explained the right solution to your problem: https://groups.google.com/d/msg/codenameone-discussions/bOTc1-QzE08/xazvNnz9FAAJ
Reply all
Reply to author
Forward
0 new messages