Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
cmr1990
Posts: 59
Registered: ‎10-16-2013
My Device: Z10
My Carrier: vodaphone

NavigationPane problem.

Hi all, this is the code i'm using..

 

in appUI. cpp

 

TabbedPane* _tpTabbedPane ;

Page * _pHome = Page::create().content(Label::create().text("HOME"));
Page * _pCall = Page::create().content(Label::create().text("CALL"));
Page * _pSearch = Page::create().content(Label::create().text("SEARCH"));
Page * _pLocation = Page::create().content(Label::create().text("LOCTION"));


_npNavPane = NavigationPane::create().add(_pHome) ;

_tHome = Tab::create().content(_npNavPane) ;
_tSearch = Tab::create().content(_pSearch) ;
_tCall = Tab::create().content(_pCall) ;
_tLocation = Tab::create().content(_pLocation) ;

_tpTabbedPane = TabbedPane::create()
.showTabsOnActionBar(true)
.add(_tHome)
.add(_tSearch)
.add(_tCall)
.add(_tLocation) ;


QObject::connect(_tHome, SIGNAL(triggered()),
this, SLOT(onHome()));


QObject::connect(_tSearch, SIGNAL(triggered()),
this, SLOT(onSearch()));


QObject::connect(_tCall, SIGNAL(triggered()),
this, SLOT(onCall()));


QObject::connect(_tLocation, SIGNAL(triggered()),
this, SLOT(onLocation()));


app->setScene(_tpTabbedPane) ;

 

the slots :

 

void ApplicationUI::smileysurprised:nHome() {

}

void ApplicationUI::smileysurprised:nSearch() {
_npNavPane->push(Page::create().content(Label::create().text("ON SEarchhhh"))) ;
}

void ApplicationUI::smileysurprised:nCall() {
_npNavPane->push(Page::create().content(Label::create().text("ON CalLLL"))) ;
}

void ApplicationUI::smileysurprised:nLocation() {
_npNavPane->push(Page::create().content(Label::create().text("ON LoC"))) ;
}

 

hpp file :

 

class ApplicationUI : public QObject
{
Q_OBJECT
NavigationPane *_npNavPane ;
Tab* _tHome ;
Tab* _tCall ;
Tab* _tSearch ;
Tab* _tLocation ;
public:
ApplicationUI(bb::cascades::Application *app);
virtual ~ApplicationUI() { }
private slots:
void onSystemLanguageChanged();
void onHome() ;
void onSearch() ;
void onCall() ;
void onLocation() ;
private:
QTranslator* m_pTranslator;
bb::cascades::LocaleHandler* m_pLocaleHandler;
};

 

My problem being: when i click 3rd tab, the slot gets executed, but the page is pushed on the 1st tab, which is only visible when i manually goto the first tab.

 

What i expect is : irrespective from which tab i push the page, it shoud be immidatly visible to me.

I want to use only one navigation pane. not 4 for all the 4 tabs.

 

Please help!

Thanks.

Please use plain text.
Developer
Zmey
Posts: 1,507
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: NavigationPane problem.

Technically this probably can be done by reparenting the NavigationPane to the new tab in activePaneChanged signal handler, but wouldn't this confuse the user? Why not create a different Page for each tab? I think the user will assume that tabs switch pages, not work as buttons.

Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Regular Contributor
cmr1990
Posts: 59
Registered: ‎10-16-2013
My Device: Z10
My Carrier: vodaphone

Re: NavigationPane problem.

yes even i think it is very confusing. so I'm left with 4 nav panes for 4 tabs i guess..!

Please use plain text.
Developer
BBSJdev
Posts: 5,948
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: NavigationPane problem.

[ Edited ]

I think the only other valid use of the Tab is as a filter where no new page is pushed but the contents change accordingly, this is done in a few of the Native apps.

 

As Zmey says there are ways to do it but where you can try and stay within the users expectation of what each UI element does you probably should.

 

When entering code don't forget to use the 'insert code' button the clipboard with a 'C' on it.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.