views:

365

answers:

2

I am trying to create a MainScreen with vertical scrolling. From what I've read in the documentation, MainScreen has a VerticalManager inside, so it should be possible to enable vertical scrolling only with proper construction, i.e:

super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);

This is not working for me, however. I am creating a screen, adding a couple of LabelFields and no scrollbar, no scrolling at all. I am testing on 8900, OS 5.0.

Here is the code I use:

public class ExampleScreen extends MainScreen {

    public ExampleScreen() {
        super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
        create();
    }

    private void add(String text) {
        add(new LabelField(text));
    }

    private void create() {
        add("line 0");
        add("line 1");
        ...
        etc
        ...
    }
}

The question is am I doing something wrong? Is there a way to enable vertical scrolling with MainScreen or do I need to create a VerticalManager myself?

A: 

Duplicates of this

Michael B.
No, it's not. My question concerns vertical scrolling with `MainScreen`. Though, should the solution to this other question work, I'll accept your answer.
pajton
@pajton Look at the solution it's the same.
Michael B.
Difference is here we have option to make each label focusable. In previous question there was single large label.
Max Gontar
Difference is that this question concerns `MainScreen`. The same answer doesn't mean the same question:].
pajton
Adding only one Focusable field just scrolled my screen to the end.
pajton
+2  A: 

The LabelField(s) added to the screen should either be FOCUSABLE themselves, or you can add the following BETWEEN each of the label fields: add(new NullField(NullField.FOCUSABLE));

Andrey Butov