1

I have created 3 tabs in my blackberry application.I now want to add an eyelid field manager that allows for an eye lid component only on the third tab.

With the current code, i am able to create an eyelid but it doesnt show me any of the tabs.

  // setup the tab model with 3 tabs
 final PaneManagerModel model = new PaneManagerModel();
  model.enableLooping( true );

  // setup the first tab
  VerticalFieldManager vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  LabelField lbl = new LabelField( "Content for tab 1", Field.FOCUSABLE );
  vfm.add( lbl );



  ButtonField _btnGoBack = new ButtonField(" Tab 3 ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
      _btnGoBack.setChangeListener(new FieldChangeListener() 
      {
            public void fieldChanged(Field field,int context) 
            {

                  System.out.println("Inside button");
                  jumpTo(2,PaneManagerView.DIRECTION_NONE);
            }

       });
  vfm.add(_btnGoBack);



  MyLabelField myLbl = new MyLabelField( "Tab 1" );
  NullField nullFld = new NullField( Field.FOCUSABLE );
  HorizontalFieldManager hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );

  Pane pane = new Pane( hfm, vfm );
  model.addPane( pane );


  // setup the second tab
  vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  lbl = new LabelField( "Content for tab 2", Field.FOCUSABLE );
  vfm.add( lbl );

  myLbl = new MyLabelField( "Tab 2" );
  nullFld = new NullField( Field.FOCUSABLE );
  hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );

  pane = new Pane( hfm, vfm );
  model.addPane( pane );

  //Setup the third tab
  vfm = new VerticalFieldManager( 
      Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
      Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
  lbl = new LabelField( "Content for tab 3", Field.FOCUSABLE );
 vfm.add( lbl );
  myLbl = new MyLabelField( "Tab 3" );
  nullFld = new NullField( Field.FOCUSABLE );
  hfm = new HorizontalFieldManager();
  hfm.add( nullFld );
  hfm.add( myLbl );
  ((LabelField)myLbl).setEnabled(false);
  ((NullField)nullFld).setEnabled(false);

Here i start the implemenatation for eyelid field manager

    _eyelidFieldManager = new EyelidFieldManager();

    // Change the display time from the default 1.2s
    _eyelidFieldManager.setEyelidDisplayTime(2000);

    // Add components to the north eye-lid of the blinker

    _eyelidFieldManager.vfm.addTop(new LabelField(" Do you wish to send report to client?",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));  
    _eyelidFieldManager.addTop(new LabelField("                                      ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));               


  // Add components to the south eye-lid of the blinker
    _eyelidFieldManager.addBottom(new LabelField(" Send Report as: ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
    HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_HCENTER | Field.USE_ALL_WIDTH);
    buttonPanel.add(new ButtonField("SMS"));
    buttonPanel.add(new ButtonField("Email"));
    _eyelidFieldManager.addBottom(buttonPanel);

    // Add checkbox in non-eyelid region for showing eyelids on user input        
    _showOnInputCheckbox = new CheckboxField("Show eyelids on user input", true, Field.FIELD_HCENTER);
    _showOnInputCheckbox.setChangeListener(this);


    add(_eyelidFieldManager); 

    // Disable virtual keyboard so it doesn't obscure bottom eyelid
    VirtualKeyboard keyboard = getVirtualKeyboard();
    if( keyboard != null )
    {
        keyboard.setVisibility(VirtualKeyboard.IGNORE);
    }

  pane = new Pane( hfm, vfm );
  model.addPane( pane );


  // select the tab to be displayed
  model.setCurrentlySelectedIndex( 0 );    

Now set up the rest of the tab components

  // setup the rest of the components
  HorizontalTabTitleView titleView = new HorizontalTabTitleView( Field.FOCUSABLE );
  titleView.setNumberOfDisplayedTabs( 3 );
  titleView.setModel( model );

  PaneView paneView = new PaneView( Field.FOCUSABLE );
  paneView.setModel( model );

  PaneManagerView view = new PaneManagerView( 
          Field.FOCUSABLE  | Manager.NO_VERTICAL_SCROLL | 
          Manager.NO_HORIZONTAL_SCROLL | Manager.USE_ALL_HEIGHT | 
          Manager.USE_ALL_WIDTH, 
          titleView, paneView );
  view.setModel( model );
  model.setView( view );

  // configure the Controller
  HorizontalTabController controller = new HorizontalTabController();
  controller.setModel( model );
  controller.setView( view );
  model.setController( controller );
  view.setController( controller );

  // add the tab manager to the MainScreen
  this.add( view );
}

Anyone aware on a solution please guide.Thanks

learning_fly
  • 382
  • 1
  • 2
  • 11
  • The eyelid thing is full of glitches. I only managed to get a decent look by using only the upmost lid. I wanted to use both lids and add field in between, but then you have to use it as an AbsoluteFieldManager (don't remember the exact class name), and by doing this the scroll doesn't work. So good luck man. – Mister Smith May 14 '12 at 14:23
  • I cant understand where exactly u were facing problem.Weren't u able to see both the lids.Albeit that part worked in my case. – learning_fly May 14 '12 at 14:34
  • Yea, both lids (the animation for the bottommost one was awful), but no scroll for the fields added between lids. I reached the conclusion that this field is hardly useful as it is provided. – Mister Smith May 14 '12 at 14:38
  • I have simply included the eyelid field code from the samples that came with the JDE.I wasn't much bothered about the eyelid display as long as i could view it onto my tab pane manager.But hard luck on that.Anyway,lets see if AbsoluteFieldManager thing works.Thanks for leaving a response man. – learning_fly May 14 '12 at 14:43

0 Answers0