嘿,在我的屏幕上有一个编辑字段和 2 个自定义按钮字段,分别为“确定”和“取消”按钮字段下方有一些更可聚焦的标签字段
当我在编辑字段中写一个名字并按下回车键时,焦点来到“确定”按钮,但如何将焦点设置在“取消”按钮上。
此外,在滚动焦点时不会自动向前移动???
我该怎么做可能会与触摸事件及其处理混淆!!!
请帮忙!!!!!!!!!!!!
代码:
txt_Name = new EditField(TextField.NO_NEWLINE)
{
public void paint(net.rim.device.api.ui.Graphics g)
{
g.setColor(Color.MAROON);
super.paint(g);
}
};
txt_Name.setFont(font);
v1 = new VerticalFieldManager();
v1.add(txt_Name );
ButtonField btn1 = new ButtonField("OK",ButtonField.CONSUME_CLICK);
ButtonField btn2 = new ButtonField("CANCEL",ButtonField.CONSUME_CLICK);
v2 = new VerticalFieldManager();
v2.add(btn1);
v2.add(btn2);
LabelField l1 = new LabelField("Hello Moon ",Field.Focussable);
LabelField l2 = new LabelField("Hello Citizen",Field.Focussable);
LabelField l3 = new LabelField("Hello People",Field.Focussable);
LabelField l4 = new LabelField("Hello world",Field.Focussable);
v3 = new VerticalFieldManager();
v3.add(l1);
v3.add(l2);
v3.add(l3);
v3.add(l4);
add(v1);
add(v2);
add(v3);
}
protected boolean navigationClick(int status, int time)
{
if(OK.isFocus())
{
//execute some code
return true;
}
if(CANCEL.isFocus())
{
//execute some code
return true;
}
}