blue-sky
blue-sky

Reputation: 53816

Disable scrolling in vertical field manager

I have two vertical field managers, I want to enable scrolling on the first and disable it on the second. So as I scroll just one verticalfield manager scrolls and all other content remains in place. Just myv2 should scroll Currently the entire screen scrolls.

    final TweetOptionsVerticalFieldManager myv = new TweetOptionsVerticalFieldManager(USE_ALL_WIDTH | NO_VERTICAL_SCROLLBAR | VerticalFieldManager.NO_VERTICAL_SCROLL){

    //override in order to set maximum height for the manager
    protected void sublayout( int maxWidth, int maxHeight )
    {
        //set width
        int displayWidth = Display.getWidth();
        //set height
        int displayHeight = tweetBtnManager.getHeight() + Constants.HEADER_LOGO.getHeight();

        super.sublayout( displayWidth, maxHeight);
        setExtent( displayWidth, displayHeight);
    }

}; 

    TwitterMainVerticalFieldManager2 myv2 = new TwitterMainVerticalFieldManager2(USE_ALL_HEIGHT | USE_ALL_WIDTH | VERTICAL_SCROLLBAR | VERTICAL_SCROLL){

    //override in order to set maximum height for the manager
    protected void sublayout( int maxWidth, int maxHeight )
    {
        //set width
        int displayWidth = Display.getWidth();
        //set height
  //      int displayHeight = Display.getHeight() - tweetBtnManager.getHeight() - tweetBtnManager.getPaddingTop() - tweetBtnManager.getPaddingBottom() - Constants.HEADER_LOGO.getHeight();

        int displayHeight = Display.getHeight();

        super.sublayout( displayWidth, displayHeight);
        setExtent( displayWidth,  displayHeight - myv.getHeight());
    }

}; 

    add(myv);
    add(myv2);

Upvotes: 0

Views: 1331

Answers (1)

Vit Khudenko
Vit Khudenko

Reputation: 28418

This code

add(myv);
add(myv2);

actually adds your VFMs to the screen's internal VFM, which by default has scrolling. So I suspect you just observe srolling originated from the internal screen's VFM.

To disable scrolling of the screen's internal VFM pass the same scrolling disabling style to the screen's constructor:

// YourScreen constructor
public YourScreen() {
    super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
    // the rest of the code that creates/adds child fields
}

Upvotes: 1

Related Questions