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: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Shared page pushed to different navigation pane cause multiple "back" button.

[ Edited ]

Hi All,

 

I have some comment page that can be shared amount the whole application (e.g. a help page). I learned that when the page is poped from one navigation pane, and need to push to another, you need to set parent to null. I did that, and it can be pushed to another navigation pane, how ever, there are 2 "back" button shown when it is pushed to another navigation pane. When it is pushed to third one, then 3 "back" button ....

 

To push the page, I do something like:

pageToBePushed -> setParent(NULL);
navigationPane -> push(pageToBePushed);

 And I use the defualt "back" button to pop it.

 

Anyone has an idea on how to resolve the mulitiple "back" button issue?

 

thanks,

Dong

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Shared page pushed to different navigation pane cause multiple "back" button.

Hi! Can you post some code please?

Which function do you use to remove the page from NagivationPane? pop() or remove()?

Where do you reset the parent?

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: Shared page pushed to different navigation pane cause multiple "back" button.

Hi Zemy,

I have edited my original post by adding some code, thanks for your help!

Dong
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Shared page pushed to different navigation pane cause multiple "back" button.

The page should be removed from NavigationPane by calling either pop() (and waiting for popTransitionCompleted) or remove() otherwise the pane will still reference it. I think it's not enough to just reset the parent.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: Shared page pushed to different navigation pane cause multiple "back" button.

Doesn't the default "back" button do that?
Developer
Posts: 47
Registered: ‎11-23-2010
My Device: Q10
My Carrier: Rogers

Re: Shared page pushed to different navigation pane cause multiple "back" button.

[ Edited ]

Seems it does.

 

I had very similar problem, my 3 different navigation panes could use same Page to push. But after I pushed it first time from one particular pane I couldn't push it from others. Only from the pane I used 1st time. After I added one line in

onPopTransitionEnded I fixed the problem:

 

void ApplicationUI::onPopTransitionEnded(bb::cascades::Page* page)
{
   ...

   page->setParent(0);
}

 You already use setParent(0) so I'm not sure if I really helped you.

 

Regards

 

 

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Shared page pushed to different navigation pane cause multiple "back" button.

I'm creating such pages dynamically and always destroy from pop() -

have you tried this approach ?

dynamic components are really fast created by cascades

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 47
Registered: ‎11-23-2010
My Device: Q10
My Carrier: Rogers

Re: Shared page pushed to different navigation pane cause multiple "back" button.

ekke, I think your approach will help him to eliminate the problem, cause his multibuttons issue is definitely because he creates that "back" button multiple times. But what if he wants just reuse same page again and again without delete/create many times. It can be costly in some cases.

contryboy, I think what happens is that everytime you push page you've been creating that "back" button. Check this part of code. If it is possible then share more with us, so we can take a look too.

Regards
Highlighted
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Shared page pushed to different navigation pane cause multiple "back" button.

only mentioned the dynamic way because perhaps he never did this before ;-)

 

and - from my experiences - even complex pages are created really fast by Cascades, so in the meantime nearly 80% of my pages are created dynamically every time they're pushed.

 

and Tabs are created the first time user hits on a Tab - then 1st page of NavigationPane is created and most of the other stuff is done dynamically

 

there's some kind of internal caching in Cascades, so creating same page again and again it becomes faster

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner