I have a grid container wchich consist two button.and i add this container in the form. When i click on the button it is working fine but when i click o开发者_运维知识库utside the buttons then the event fired by those button which have the focus at that time.
GridFieldManager startStopButtonContainer = new GridFieldManager(2,Field.FIELD_HCENTER);
startStopButtonContainer.add(slideRestart);
startStopButtonContainer.add(slideStop);
add(startStopButtonContainer);
now i click on the slideRestart it works fine but when i click outside the button then also it is taking event.
Please help me out...:)
Add nullfield at starting & ending at each row of the gridfieldManager.And set style Field.Non_FOCASABLE to that nullfields.And set the default focus at buttonfield.
Note: nullfields must cover the remaining part of gridfieldManager.
you can use
LabelField field = new LabelField(" ",Field.NON_FOCUSABLE)
{
protected void layout(int width, int height)
{
// TODO Auto-generated method stub
super.layout(width, height);
setExtent((Display.getWidth()-(buttonField.getPreferredWidth()+buttonField.getPreferredWidth())/2, height);
}
};
as nullfield.
精彩评论