如何在黑莓中将焦点设置为Fieldmanager

时间:2012-04-22 06:18:23

标签: blackberry

我是黑莓新手。我们可以将焦点和点击事件设置为BlackBerry中的verticalFieldManager吗?

这是我的代码:

 VerticalFieldManager itemdesc=new VerticalFieldManager(Field.FOCUSABLE);


          LabelField pdtitem=new LabelField(pdts.getProducts_name(),LabelField.FOCUSABLE){
              protected void drawFocus(Graphics graphics, boolean on)    
             {          
                // setSpace(5, 5);      
                 super.drawFocus(graphics, on);  
                 }
              protected boolean navigationClick(int status, int time) {
                // TODO Auto-generated method stub
                    UiApplication.getUiApplication().pushScreen(new desc(V,j));
                return true;
            }


          };



          itemdesc.add(pdtitem);

          Bitmap cartbt=Bitmap.getBitmapResource("cart3.png");
          BitmapField cartbtn=new BitmapField(cartbt,Field.FOCUSABLE){
              protected void drawFocus(Graphics graphics, boolean on)    
             {          
                 setSpace(5, 5);      
                 super.drawFocus(graphics, on);  
                 }

              protected boolean navigationClick(int status, int time) {
                // TODO Auto-generated method stub
                  PopupScreen pp=new PopupScreen(new login());

                Dialog.alert("hai");
                UiApplication.getUiApplication().pushScreen(pp);
                return super.navigationClick(status, time);
            }
          };

1 个答案:

答案 0 :(得分:0)

您可以将方法添加到新的Horizo​​ntalFieldManager

public boolean isFocusable(){
return true;

}