learning_fly
learning_fly

Reputation: 392

Is it possible to dynamically add tabs in blackberry

Is it possible to dynamically add tabs in blackberry application?

I have found this piece of code that works for java but when i try doing for blackberry in BB JDE it doesnt give any result.

final TabSheet tabSheet = new TabSheet();

Button button = new Button("Add the tab");
button.addListener(
    new Button.ClickListener(){
        public void buttonClick(ClickEvent event) {
            VerticalLayout content = new VerticalLayout();
            content.addComponent(new Label("This is the tab content."));
            Tab tab = tabSheet.addTab(content, "The new Tab", null);
        }
     }
);

I implemented in blackberry this way

final TabSheet tabSheet = new TabSheet();
ButtonField button = new ButtonField("Add the tab");
button.setChangeListener(
    new FieldChangeListener() 
    {
        public void fieldChanged(Field field,int context) 
        {
            VerticalFieldManager content = new VerticalFieldManager();
            content.addComponent(new LabelField("This is the tab content."));
            Tab tab = tabSheet.addTab(content, "The new Tab", null);
        }
    }
);

There is something wrong with use of "tabsheet" identifiers. What would be their substitute way in blackberry?

Update:

final PaneManagerModel tabsheet = new PaneManagerModel();
ButtonField button = new ButtonField("Add the tab");
button.setChangeListener(
    new FieldChangeListener() 
    {
        public void fieldChanged(Field field,int context) 
        {
            VerticalFieldManager content = new VerticalFieldManager();
            content.add(new LabelField("This is the tab content."));
            Pane panenew = new Pane(New,3);//Are the pane parameters right? 
            model.addPane(content, "The new Tab", null);//Can model be applied to this type?
        }
    }
);

Upvotes: 1

Views: 200

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597091

Blackberry does not have TabSheet and Tab classes. In BBOS 6.0 and later, you can use the PanelManagerModel, PaneManagerView, PaneManagerController, and Pane classes instead.

Upvotes: 1

Related Questions