在blackberry中使用垂直字段管理器和眼睑字段管理器
我在我的黑莓应用程序中创建了3个标签。我现在想添加一个眼睑字段管理器,只允许在第三个标签上使用眼睑组件 使用当前代码,我可以创建眼睑,但它不会显示任何选项卡在blackberry中使用垂直字段管理器和眼睑字段管理器,blackberry,tabs,fieldmanager,Blackberry,Tabs,Fieldmanager,我在我的黑莓应用程序中创建了3个标签。我现在想添加一个眼睑字段管理器,只允许在第三个标签上使用眼睑组件 使用当前代码,我可以创建眼睑,但它不会显示任何选项卡 // setup the tab model with 3 tabs final PaneManagerModel model = new PaneManagerModel(); model.enableLooping( true ); // setup the first tab VerticalFieldManage
// setup the tab model with 3 tabs
final PaneManagerModel model = new PaneManagerModel();
model.enableLooping( true );
// setup the first tab
VerticalFieldManager vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
LabelField lbl = new LabelField( "Content for tab 1", Field.FOCUSABLE );
vfm.add( lbl );
ButtonField _btnGoBack = new ButtonField(" Tab 3 ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
_btnGoBack.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
System.out.println("Inside button");
jumpTo(2,PaneManagerView.DIRECTION_NONE);
}
});
vfm.add(_btnGoBack);
MyLabelField myLbl = new MyLabelField( "Tab 1" );
NullField nullFld = new NullField( Field.FOCUSABLE );
HorizontalFieldManager hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
Pane pane = new Pane( hfm, vfm );
model.addPane( pane );
// setup the second tab
vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
lbl = new LabelField( "Content for tab 2", Field.FOCUSABLE );
vfm.add( lbl );
myLbl = new MyLabelField( "Tab 2" );
nullFld = new NullField( Field.FOCUSABLE );
hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
pane = new Pane( hfm, vfm );
model.addPane( pane );
//Setup the third tab
vfm = new VerticalFieldManager(
Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH |
Manager.NO_VERTICAL_SCROLL | Manager.NO_HORIZONTAL_SCROLL );
lbl = new LabelField( "Content for tab 3", Field.FOCUSABLE );
vfm.add( lbl );
myLbl = new MyLabelField( "Tab 3" );
nullFld = new NullField( Field.FOCUSABLE );
hfm = new HorizontalFieldManager();
hfm.add( nullFld );
hfm.add( myLbl );
((LabelField)myLbl).setEnabled(false);
((NullField)nullFld).setEnabled(false);
在这里,我开始实现眼睑字段管理器
_eyelidFieldManager = new EyelidFieldManager();
// Change the display time from the default 1.2s
_eyelidFieldManager.setEyelidDisplayTime(2000);
// Add components to the north eye-lid of the blinker
_eyelidFieldManager.vfm.addTop(new LabelField(" Do you wish to send report to client?",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
_eyelidFieldManager.addTop(new LabelField(" ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
// Add components to the south eye-lid of the blinker
_eyelidFieldManager.addBottom(new LabelField(" Send Report as: ",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE));
HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_HCENTER | Field.USE_ALL_WIDTH);
buttonPanel.add(new ButtonField("SMS"));
buttonPanel.add(new ButtonField("Email"));
_eyelidFieldManager.addBottom(buttonPanel);
// Add checkbox in non-eyelid region for showing eyelids on user input
_showOnInputCheckbox = new CheckboxField("Show eyelids on user input", true, Field.FIELD_HCENTER);
_showOnInputCheckbox.setChangeListener(this);
add(_eyelidFieldManager);
// Disable virtual keyboard so it doesn't obscure bottom eyelid
VirtualKeyboard keyboard = getVirtualKeyboard();
if( keyboard != null )
{
keyboard.setVisibility(VirtualKeyboard.IGNORE);
}
pane = new Pane( hfm, vfm );
model.addPane( pane );
// select the tab to be displayed
model.setCurrentlySelectedIndex( 0 );
现在设置其余选项卡组件
// setup the rest of the components
HorizontalTabTitleView titleView = new HorizontalTabTitleView( Field.FOCUSABLE );
titleView.setNumberOfDisplayedTabs( 3 );
titleView.setModel( model );
PaneView paneView = new PaneView( Field.FOCUSABLE );
paneView.setModel( model );
PaneManagerView view = new PaneManagerView(
Field.FOCUSABLE | Manager.NO_VERTICAL_SCROLL |
Manager.NO_HORIZONTAL_SCROLL | Manager.USE_ALL_HEIGHT |
Manager.USE_ALL_WIDTH,
titleView, paneView );
view.setModel( model );
model.setView( view );
// configure the Controller
HorizontalTabController controller = new HorizontalTabController();
controller.setModel( model );
controller.setView( view );
model.setController( controller );
view.setController( controller );
// add the tab manager to the MainScreen
this.add( view );
}
任何知道解决方案的人,请指导。谢谢眼睑问题充满了小故障。我只用了最上面的盖子,才勉强看了一眼。我想同时使用lids和addfield,但是你必须把它作为一个绝对的fieldmanager来使用。我不记得确切的类名,这样做滚动就不起作用了。祝你好运。我不知道你到底在哪里遇到了问题。你不能同时看到两个盖子。尽管这部分在我的情况下起了作用。是的,两个盖子最下面的一个的动画很糟糕,但是没有在盖子之间添加字段的滚动。我得出的结论是,由于提供了该字段,该字段几乎没有用处。我只是从JDE附带的示例中包含了眼睑字段代码。只要我可以在选项卡窗格管理器上查看眼睑显示,我就不太在意它。但在这方面运气不好。无论如何,让我们看看AbsoluteFieldManager这件事是否奏效。谢谢你留下回复人。