Search code examples
blackberry

Blackberry vertical scrolling for side by side vertical managers


I have to built this UI for Blackberry JRE 4.6 & above. Please suggest the approach for this UI.

enter image description here


Solution

  • I solved the problem, here is the approach,

    1. Take horizontal manager for header

      HorizontalFieldManager nonscrollableHFM= new HorizontalFieldManager();

    2. Take another horizontal manager as a container

      HorizontalFieldManager containerHfm = new HorizontalFieldManager();

      2.1 Add vertical manager for left section (Non Scrollable)

      VerticalFieldManager leftVfm = new VerticalFieldManager();

      2.2 Create a custom vertical manager for right section as below

    {

       class RightVfm extends VerticalFieldManager {
    
      RightVfm() {
    
        super(VERTICAL_SCROLL | VERTICAL_SCROLLBAR | NO_HORIZONTAL_SCROLL
        | NO_HORIZONTAL_SCROLLBAR | USE_ALL_WIDTH);
    
          }
    
      protected void sublayout(int width, int height) {
    
          super.sublayout(width, getPreferredHeight());
    
          setExtent(width, getPreferredHeight());
    
      }
    
      public int getPreferredWidth() {
    
         return _width;
    
      }
    
    public void setWidth(int w) {
    
                _width = w;
    
            }
    
    public int getPreferredHeight() {
    
                return _height;
    
            }
    
    public void setHeight(int h) {
    
                _height = h;
    
            }
    
        private int _width;
        private int _height;
    
    };
    

    }

    1. Adjust the height & width of right verticle manager by calling setHeight & setWidth methods

      I got help from here, http://www.blackberryforums.com/developer-forum/209190-set-height-verticalfieldmanager.html