views:

42

answers:

1

hi all

I am not able select the custombuttonfield

Here is my code:-

 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);
    }

}

when i am clicking help or developer button its not selecting.

A: 

override the

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

in your CustomSmallButton class

Vivart