title: TabField at the bottom of screen not producing click event at all tabs other then 1st tab in blackberry?
body: <p>I am working in a BlackBerry application in which I need to use the tabs at the bottom.</p>
  
  <p>Earlier I had already used the tabs but at the top of the screen. To place the tabs at the bottom of the screen I used the <code>sublayout()</code> method. But the side effects of this is I can't use the <code>display(index)</code> method now. Every time when i click on any of the tab, only 1st tab get selected. When i hide the <code>sublayout()</code> method than everything works fine.</p>
  
  <p>This is my code that I am using: </p>
  
  <p><strong>TabControl.java</strong></p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>public class TabControl extends MainScreen{
      public static int tabHeight = 0;
      public static TabField mTabField = null;
      public static Bitmap BACKGROUND_IMAGE = Bitmap
      .getBitmapResource("Background_Superhero.png");
      private UiApplication uiApp = UiApplication.getUiApplication();
      private UiEngine ui = Ui.getUiEngine();
      private int displayHieght;
      public TabControl(BuddyListField buddyList) {
          super(MainScreen.NO_VERTICAL_SCROLL);
      }
      public void addFields() {
          try {
              mTabField = new TabField(this);
              add(mTabField);
              HomeTab home = new HomeTab();
              mTabField.addTab(Bitmap.getBitmapResource("home_tab.png"), home,
                      Field.FOCUSABLE);
              SettingTab setting = new SettingTab();
              mTabField.addTab(Bitmap.getBitmapResource("Setting_tab.png"), setting,
                      Field.FOCUSABLE);
              AboutTab about = new AboutTab();
              mTabField.addTab(Bitmap.getBitmapResource("abouttab.png"), about,
                      Field.FOCUSABLE);
  
              mTabField.setDefault(Constant.SETTING_TAB_INDEX);
          } catch (Exception e) {
              System.out.println(e+"=-====&gt;&gt;TabControl");
              e.printStackTrace();
          }
      }
      protected boolean keyDown(int keycode, int time) {
          if (keycode == 1769472) {
              // escape pressed
              return true;
          }
          return super.keyDown(keycode, time);
      }
  }
  </code></pre>
  
  <p><strong>TabField.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>public class TabField extends VerticalFieldManager {
  
  
      private static Bitmap tabBackGroundImage = Bitmap
      .getBitmapResource("tab_bar.png");
      private Background CONTROL_NORMAL_BG = BackgroundFactory
      .createBitmapBackground(tabBackGroundImage);
      private Background CONTROL_ACTIVE_BG = BackgroundFactory
      .createSolidBackground(Color.SILVER);
  
      public static int indexValue = 0;
      private static int mCurrentIndex = 0;
      private int mDefault = 0;
  
      private Field mCurrentField = null;
      private Vector mTabFields = new Vector();
      private MainScreen _mainscreen = null;
      private HorizontalFieldManager mTabController = new HorizontalFieldManager();
  
      private UiApplication uiApp = UiApplication.getUiApplication();
      private UiEngine ui = Ui.getUiEngine();
      private int tabHieght;
      private int displayHieght;
  
  
      public TabField(MainScreen mainscreen) {
          super(MainScreen.USE_ALL_HEIGHT);
          _mainscreen = mainscreen;
          displayHieght = Display.getHeight();
  
          add(mTabController);
          SeparatorField separatorField = new SeparatorField();
          separatorField.setBackground(CONTROL_ACTIVE_BG);
          add(separatorField);
  
      }
  
      public void setDefault(int index) {
          mDefault = index;
          if (mDefault &lt;= mTabFields.size() - 1) {
              display(mDefault);
          }
      }
  
      public void display(int index) {
          VirtualKeyboard virtKbd = _mainscreen.getVirtualKeyboard();
          if(virtKbd != null)
              virtKbd.setVisibility(VirtualKeyboard.RESTORE);
  
          try {
              if (mCurrentField != null) {
                  if (mCurrentField instanceof TabFieldItem) {
                      ((TabFieldItem) mCurrentField).onUnSelected();
                  }
                  delete(mCurrentField);
              }
              mCurrentField = (Field) mTabFields.elementAt(index);
              add(mCurrentField);
              mCurrentField.setFocus();
  
              if (mCurrentField instanceof TabFieldItem) {
                  ((TabFieldItem) mCurrentField).onSelected();
              }
  
              setDirty(false);
              BitmapField mCurrentBG = (BitmapField) mTabController
              .getField(mCurrentIndex);
  
              mCurrentBG.setBackground(CONTROL_NORMAL_BG);
              mCurrentBG.setBitmap(getOnUnFocusImg(mCurrentIndex));
              BitmapField mBG = (BitmapField) mTabController.getField(index);
              mBG.setBackground(CONTROL_ACTIVE_BG);
              mBG.setBitmap(getOnFocusImg(index));
              mCurrentIndex = index;
              if(virtKbd != null)
                  virtKbd.setVisibility(VirtualKeyboard.HIDE);
              if (indexValue == 3) {
  
  
              }
          } catch (Exception e) {
              System.out.println("Exception: In TabField---&gt;display() "
                      + e.toString());
          }
      }
  
      public void addTab(Bitmap aBitmap, final Field aTabField, long style) {
          BitmapField lButton = null;
          if (style == Field.FOCUSABLE) {
              final BitmapField focusbleButton = new BitmapField(aBitmap,
                      Field.FOCUSABLE) {
                  protected boolean navigationClick(int status, int time) {
                      if (aTabField == null) {
                          return false; 
                      }
                      indexValue = getIndex();
                      display(indexValue);
                      return true;
                  }
  
                  protected void paint(Graphics graphics) {
                      if (indexValue == getIndex()) {
                          graphics.setBackgroundColor(Color.SILVER);
                          graphics.clear();
                      }
                      super.paint(graphics);
                  }
  
                  public void setSpace(int hSpace, int vSpace) {
  
                      super.setSpace(hSpace, vSpace);
                  }
              };
              focusbleButton.setBackground(CONTROL_NORMAL_BG);
              setlButtonSpace(focusbleButton);
              lButton = focusbleButton;
          } else {
              lButton = new BitmapField(aBitmap);
          }
          /*if (WallpaperMainScreen.tabHeight == 0)
              WallpaperMainScreen.tabHeight = lButton.getBitmapHeight();*/
          mTabController.add(lButton);
          mTabFields.addElement(aTabField);
  
          if (mDefault == mTabFields.size() - 1 &amp;&amp; aTabField != null) {
              display(mDefault);
          }
      }
  
      //SUBLAYOUT METHOD USED TO BRING THE TABBAR AT THE BOTTOM OF THE SCREEN---------------
      protected void sublayout(int maxWidth, int maxHeight) {
          super.sublayout(maxWidth, maxHeight);
          tabHieght = mTabController.getHeight();
          int y = displayHieght - tabHieght;
          setPositionChild(mTabController, 0, y);
      }
  
  
      private void setlButtonSpace(BitmapField lButton) {
          int tabWidth = Display.getWidth() / 3;
          int imagewidth = lButton.getBitmapWidth();
          int imageheight = lButton.getBitmapHeight();
          int hPaddingValue = (tabWidth - imagewidth) / 2;
          int vPaddingValue = (tabWidth - imageheight) / 7;
          lButton.setSpace(hPaddingValue + 1, vPaddingValue);
      }
  
      private Bitmap getOnFocusImg(int index) {
          Bitmap image = null;
          switch (index) {
          case 0:
              image = Bitmap.getBitmapResource("home_tab.png");
              break;
          case 1:
              image = Bitmap.getBitmapResource("Setting_tab.png");
              break;
          case 2:
              image = Bitmap.getBitmapResource("about_tab.png");
              break;
          /*case 3:
              image = Bitmap.getBitmapResource("exit_tab.png");
              break;
  */
          }
          return image;
      }
  
      private Bitmap getOnUnFocusImg(int currentIndex) {
          Bitmap image = null;
          switch (currentIndex) {
          case 0:
              image = Bitmap.getBitmapResource("home_tab.png");
              break;
          case 1:
              image = Bitmap.getBitmapResource("Setting_tab.png");
              break;
          case 2:
              image = Bitmap.getBitmapResource("about_tab.png");
              break;
          /*case 3:
              image = Bitmap.getBitmapResource("exit_tab.png");
              break;*/
          }
          return image;
  
      }
  
  
      protected boolean keyChar(char ch, int status, int time) {
          if (mCurrentField != null &amp;&amp; mCurrentField instanceof TabFieldItem) {
              return ((TabFieldItem) mCurrentField).keyChar(ch, status, time);
          } else {
              return super.keyChar(ch, status, time);
          }
      }
  }
  </code></pre>
  
  <p><strong>TabFieldItem.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package com.np.custom;
  
  public interface TabFieldItem {
      /**
       * Method invoked when the tabField is about to be displayed
       */
      public void onSelected();
  
      /**
       * Method invoked when the tabField is about to be removed from the display
       */
      public void onUnSelected();
  
      public boolean keyChar(char ch, int status, int time);
  
  }
  </code></pre>
  
  <p>I have used the sublyout method in TabField.java class.
  and the result is as shown in the image.</p>
  
  <p><img src="https://i.stack.imgur.com/MUco8.png" alt="enter image description here"></p>