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
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

How to push from a page with navigation pane to another page with another navigation pane?

Hi all,

 

Lets say i have a navigationpane which owns one page (main.qml), then when i try to push the page to another page which belongs to another navigationpane(login.qml) using a Onclick of a button but was unable to do so. No respond from the button. But if i remove the navigationpane from the (login.qml), it works... May i know what im doing wrong? Please help.

 

Thank you.

Regards,

Steve Chan
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: How to push from a page with navigation pane to another page with another navigation pane?

Hi Steve,

 

See the documentatio of NavigationPane#push()

http://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html#function-push-c...

 

It accepts Page as a parameter "bb::cascades:Smiley Tongueage *child"

 

It says - 

"TheNavigationPane takes the ownership of the pushed page. The owner of the pushed page must be 0.

If the owner of the pushed page is not 0, or if the pushed page itself is 0, nothing will happen."

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to push from a page with navigation pane to another page with another navigation pane?

Thanks for the quick reply,

Means that the pagetobepushed cannot have any parent like navigationpane? Means navigationpane's page to another navigationpane's page is impossible?

Regards,

Steve
Regards,

Steve Chan
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: How to push from a page with navigation pane to another page with another navigation pane?

As per documentation it says No. In begining I have also tried what you have done...

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to push from a page with navigation pane to another page with another navigation pane?

Seems the only way is to attach all the pages into one qml file and push within the qml file... thats not a good architecture. No choice then. Thanks kanak.

Regards,

Steve
Regards,

Steve Chan
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: How to push from a page with navigation pane to another page with another navigation pane?

Hey you can add Pages at runtime also if you don't will to add them in QML..

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to push from a page with navigation pane to another page with another navigation pane?

Good idea. How to add them in runtime?

 

Thank you.

 

Regards,

 

Steve

Regards,

Steve Chan
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: How to push from a page with navigation pane to another page with another navigation pane?

Hi,

 

Here is some code snippet : 

 

// I have 2 Screens, Home is First Screen, when I click News Button, It pushes News Screen on Stack
// --------------- Home Screen Functionality starts here -------------------//
HomeApp::HomeApp() {
	QmlDocument *qml = QmlDocument::create("asset:///Home.qml");
	qml->setParent(this);
	qml->setContextProperty("app",this);
	// Store NavigationPane in some variable at startup
	nav = qml->createRootObject<NavigationPane>(); //nav - variable declared in HPP
	Application::instance()->setScene(nav); 
}

// in Home.qml have a Button, on its Click
Button {
	onClicked: {
		app.pushScreen();
	}
}
					
void HomeApp::pushScreen(){
	News *newsList = new News();
	newsList->pushScreen(nav);
}
// --------------- Home Screen Functionality ends here -------------------//

//--------------News Screen # pushScreen(NavigationPane *parentRoot1) -----------------------//
void News::pushScreen(NavigationPane *parentRoot1){
	QmlDocument *qml = QmlDocument::create("asset:///NewsList.qml");
	page = qml->createRootObject<Page>();
	parentRoot = parentRoot1;
	parentRoot->push(page);
}

 

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to push from a page with navigation pane to another page with another navigation pane?

Thanks for the help kanak. Will try this and see.
Regards,

Steve Chan
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: How to push from a page with navigation pane to another page with another navigation pane?

Welcome Smiley Happy

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro