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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

how to delete stack of pages

I'm working on creating a stack of pages, but I've encountered an issue with deleting them properly

 

Currently i create pages as variants

onPopTranslationEnded i check if variant exists, if so I delete the page.

Before Now there was always only 1 page on the stack.

 

However I'm now working on a stack of pages (more than 1 page on the stack)  I can delete them by object name if closed 1 by 1, but If I swipe the back button and close them all at once, it only deletes the top most page.

 

What I'm not sure is how to diffentiate Pop All Pages between Pop 1 page, so when popping all i can iterate through and delete each open page 1 by 1.

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

Re: how to delete stack of pages

Last time I checked it was calling onPopTransitionEnded for every page which was popped, but not in reverse order as I would expect.

So, if there were page1, page2, page3 and all of them were popped, it will call onPopTransitionEnded for page1, then page2, then page3.

To verify this add console.log() to onPopTransitionEnded.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to delete stack of pages

You are correct it does delete the first pushed page towards the last. I was checking for the last page, so I'll try and change this so it checks if a prior page is being deleted beforehand.

 

Thanks for the help =)

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

Re: how to delete stack of pages

yep - this reverse order also confused me the first time I ran into it

 

another thing I'm doing to have some more control about pages from the stack

all my pages have a

property string pageName: "myName"

 

then from onPopTransitionEnded - or elsewhere when getting a page

I can test

if page.pageName == "myName" do something special

 

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

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

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to delete stack of pages

[ Edited ]

even better than creating a variable, you can simply tap into objectName Smiley Wink  This is how i'm doing it and it's working great now, didn't expect the reverse page order at all either.

 

if (page.objectName == somePage.objectName) {
    console.log("We've got a Match")
}

you can also use top.objectName to tell which page is the current viewable page

 

 

The unfortuante part is, now that I have this working I've discovered that it wont be as easy to put data into a new listview for each page (I belive it's going to require a new datamodel for each listview) and I'm not prepared for that so i'll probably stick with replacing my current listview content and work towards a multi-page solution in the future.

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

Re: how to delete stack of pages

I'm using objectname only if accessing an object from C++,

so in very less cases

 

I don't know if objectname causes some overhead internally to make it searchable from C++ and so I want to avoid any overhead.

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

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

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to delete stack of pages

hmm, interesting theory... the docs don't really clarify weather or not it would only that if unset it remains NULL.

https://developer.blackberry.com/native/reference/cascades/bb__cascades__baseobject.html#property-ob...

 

You may be right, because AFAIK the easiest thing you can reference from qml in c++ is the object name so if set it would very possibly be there ready and waiting for c++ to call it...

 

I suppose I should re-think my approach =)

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

Re: how to delete stack of pages

I'm a somewhat old-school-developer

started with Assembler and Cobol ;-)

 

so I'm always thinking about performance and RAM - even with fast processors and GB of RAM today

 

and so I'm thinking that objectnames have to managed by cascades to use them to findChild() from C++,

so I'm reducing the size of this kind of index

 

also I'm using ID's only where needed

I'm always having ID's to better structure the code, but in complex applications I'm commenting the not-needed IDs

because I think QML has to create a tree of the known IDs and if there are less, then less processing times and less RAM

 

maybe I'm wrong with my expectations, but think it's not a bad idea

 

you won't find this in my sample apps because they're small and only samples

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

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

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