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
BryceMcMurter
Posts: 32
Registered: ‎05-21-2012
My Device: Bold 9900 & Playbook
Accepted Solution

deprecatedPushQmlByString() Safe or Not

Hey Everyone,

 

Im creating the menu system for my app. I hate cluttering up a single .qml file by using

 

NavigationPane{} with multiple pages.

 

I have looked at multiple examples from the cascades documentation and generally if the have multiple .qml files they use:

 

NavigationPane.deprecatedPushQmlByString("QMLFile.qml")

 

My question is: Are we safe to use this as a solution or should I worry about this truly being deprecated if a future release? I don't want to get all this coding finished and have to recode it in a few weeks/months when this function no longer works.

 

Thanks,

 

Bryce

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: deprecatedPushQmlByString() Safe or Not

My interpretation of that name and the comments is that you can absolutely count on it being removed, and my guess would be that removal will happen in the next update which we expect next week .

 

I wouldn't worry about using it even in the interim, however, or if I'm wrong and it's still there till the Gold release.  A function very similar to that is pretty much a necessity, and other than a name change and possibly a move to another class, and maybe a tweak to the API, I expect modifying your code to the new thing will take only a minute or two with search-and-replace in your text editor.

 

Of course, that's just my opinion...

 

All that said, however, it looks like your use case may not require it.  Are you saying that you don't like having NavigationPane {   Page {}  Page {}  Page {}  } (obviously with real content in each of those, because it's making your file too long?  There's absolutely no need to do it that way, and you don't need to dynamically load the other pages to make it work.

 

Simple put those pages into other files, with the Page {} as the top-level component.  They'll still each need the same import statement for cascades.  Make sure the name of the file starts with an uppercase letter (assuming the old QML restrictions are still present from Qt), such as Page1.qml, Page2.qml, etc. Or make them more meaningful than that.

 

Then, in your NavigationPane, just reference those pages by using the base part of the filename (no .qml extension) as the component name.  That would look like this:

NavigationPane {
    Page1 { // actual content is in Page1.qml file
    }
    Page2 { // actual content is in Page2.qml file
    }
    Page3 { // should be clear now ;-)
    }
}

 


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
ekke
Posts: 1,566
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: deprecatedPushQmlByString() Safe or Not


BryceMcMurter wrote:

Hey Everyone,

 

Im creating the menu system for my app. I hate cluttering up a single .qml file by using

 

NavigationPane{} with multiple pages.

 

I have looked at multiple examples from the cascades documentation and generally if the have multiple .qml files they use:

 

NavigationPane.deprecatedPushQmlByString("QMLFile.qml")

 

My question is: Are we safe to use this as a solution or should I worry about this truly being deprecated if a future release? I don't want to get all this coding finished and have to recode it in a few weeks/months when this function no longer works.

 

Thanks,

 

Bryce


you should definitely fgo away from deprecatedPushQmlByString

 

here's HowTo:

 

you have to attach the objects to your NavigationPane

then you can use push(xxx), pop() and popAndDelete()

 

be aware that beta2 has a bug: pop() also deletes, so a 2nd push will fail

 

I'm using this all the way on my OpenSourceCascadesApp

 

hope many of the 38 issues I reported will be fixed with beta 3 ;-)

at the moment if you test my app and something only works the 1st time this is the pop() bug -

simply restart and try another workflow

 

BTW you can vote for my OpenSource Contribution (CommunityAwards)

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

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
BlackBerry Development Advisor (Retired)
gperry
Posts: 138
Registered: ‎05-11-2012
My Device: Developer

Re: deprecatedPushQmlByString() Safe or Not

deprecatedPushQmlByString is removed from the latest Beta so should not be used

 

Regards

Graham