How to update a Louuit form?

I am working on a project in which the user fills out a questionnaire, and the answers are then sent to the server. For simplicity, I just saved two questions on the screen and after pressing the next command the user receives the following two questions. I used the lwuit structure in this project.

To reduce memory requirements, I create form , questLabel1 , ansCombo1 , questLabel2 and ansCombo2 only once. and their properties are set in accordance with the current frame (screen). The problem is that you are in form 2 and scroll to the last option, and then press the next button, since you scroll through the form, it does not display the top components, even in the next form I tried so many things. creating a new instance of the form may work, but I do not want to use this, for obvious memory reasons,

Any other solution?

thanks in advance,

+4
source share
3 answers

To make it scroll so that the component is visible, check the Component / Container API javadocs. I saw on the lwuit page that offer some methods with semantics that work - scrollComponentToVisible , scrollRectToVisible . "Verifies that the component is visible in the scroll if this container scrolls ...", like this

  // above extracted from comment to an answer to make it more visible // for the case if some reader has similar problem 
+3
source

Have you tried form.revalidate() ?. Since this is useful when you are changing the hierarchy of containers and you need to redo the layout.

Update: Use requestFocus(); for the first component of the following form. It automatically focuses on the first (top) component.

+2
source

You can use form.refreshTheme () or form.revalidate () to update the form. If you made updates in any specific container, then do the same for the container.

+1
source

All Articles