Felipe
Felipe

Reputation: 537

Codename One - autoscroll the screen

In a Codename One GUI builder app when I navigate back to my Main form, the screen is always shown at the top.

How can I get the screen to auto scroll down to the part I want and retain its previous scroll?

Upvotes: 1

Views: 142

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

I'm assuming that this is a GUI builder app.

Normally this should be seamless as the UI will scroll to the last focused component but if you don't have focusable elements this might be harder. You can store the scroll Y value on the exitForm event and restore it the beforeShow event using something like:

f.addShowListener((e) -> f.scrollY(yValue));

Upvotes: 3

Related Questions