CustomButtonField未被选中

时间:2010-04-12 11:56:57

标签: blackberry blackberry-storm

我无法选择自定义按钮字段

这是我的代码: -

 public MenuScreen() 
{
    super(Screen.DEFAULT_CLOSE);
         verticalOffset=Display.getWidth();
         menuBackgroundImage=Bitmap.getBitmapResource("com/greetings/Images/MenuBackground.jpg");
         categories=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryoff.png"),0);
         categories.setChangeListener(this);
         help=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/helpon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/helpoff.png"),0);
         help.setChangeListener(this);
         developer=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuson.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuspoff.png"),0);
         developer.setChangeListener(this);


    VerticalFieldManager manager = new VerticalFieldManager()
    {
          protected void sublayout(int width, int height)
      {
              width=fwidth;
              height=fHeight;
              super.sublayout(width,height);
              setPositionChild(categories, width-240, height-350);
              setPositionChild(help, width-240, height-290);
              setPositionChild(developer, width-240, height-230);
              setExtent(width, height);
      }
    };
    manager.setBackground(BackgroundFactory.createBitmapBackground(menuBackgroundImage));
    manager.add(categories);
    manager.add(help);
    manager.add(developer);
    add(manager);

}
public void fieldChanged(Field field, int context) {
    if(field==categories)
    {
        templateCategories=new TemplateCategories(2);
    UiApplication.getUiApplication().pushScreen(templateCategories);

    }

    if(field== help)
    {
        helpScreen=new HelpScreen();
        UiApplication.getUiApplication().pushScreen(helpScreen);
    }

    if(field == developer)
    {
        developerScreen=new DeveloperScreen();
        UiApplication.getUiApplication().pushScreen(developerScreen);
    }

}

当我点击帮助或开发者按钮时,它没有选择。

1 个答案:

答案 0 :(得分:0)

覆盖

protected void drawFocus(Graphics graphics,boolean on) {
                                //code for custom focus like draw onFocusbitmap
                                super.drawFocus(graphics, on);
                            }
您的CustomSmallButton类中的