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
Contributor
nico411
Posts: 34
Registered: ‎12-20-2010
My Device: DevAlpha Beta 2
My Carrier: Orange
Accepted Solution

NavigationPane push doesn't work

Hello,

 

I'm working on an app that has a TabbedPane, with, inside the first Tab, a NavigationPane with a first Page which is my home page.

My issue is that I cannot push my second screen on the NavigationPane if I try to do it from a button.

 

To be more precise, my home page has a list which is managed by a custom GroupDataModel.

On the list, I override onTriggered to call an invokable method in my data model which pushes the second screen.

This works great.

Here is my code :

QML

onTriggered: {

    var chosenItem = dataModel.data(indexPath);

    _dataModel.didSelectItem(chosenItem);

}

 

C++

Q_INVOKABLE void MTHomeDataModel::didSelectItem(QVariantMap selectedItem) {

    MTRecipePage *recipePage = new MTRecipePage(selectedItem["id"].toInt(), navigationPane);

    navigationPane->push(recipePage->getPage());

}

 

Now, one element in my list has a button. What I want to do is exactly the same than before, to push another kind of screen. But this doesn't work.

Here is my code :

QML

onClicked: {

    Qt.homeList.dataModel.searchClicked(text);

}

 

C++

Q_INVOKABLE void MTHomeDataModel::searchClicked(QString searchText) {

    MTRecipeSearchResultsPage *results = new MTRecipeSearchResultsPage(searchText, navigationPane);

    navigationPane->push(results->getPage());

}

 

The searchClicked method is called, (on the same thread as the didSelectItem), the MTRecipeSearchResultsPage is created, but the screen isn't pushed.

 

Any idea ?

Thank you

Please use plain text.
Contributor
nico411
Posts: 34
Registered: ‎12-20-2010
My Device: DevAlpha Beta 2
My Carrier: Orange

Re: NavigationPane push doesn't work

OK, I found the problem, thank you.

Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: NavigationPane push doesn't work

Could you let us know what the problem was?
Please use plain text.
Contributor
nico411
Posts: 34
Registered: ‎12-20-2010
My Device: DevAlpha Beta 2
My Carrier: Orange

Re: NavigationPane push doesn't work

In fact, I still haven't found the solution yet but the problem wasn't in the NavigationPane itself.

 

I posted the new issue here : http://supportforums.blackberry.com/t5/Cascades-Development/Cannot-access-outside-QML-elements-from-...

 

The problem was that I retrieved the NavigationPane from the list's dataModel.

However, the dataModel I got wasn't the one associated with the homeScreen of the Tab I was interracting with, but another one associated with another instance of the homeScreen I had on another Tab.

 

Basically, I was trying to push my second screen on another NavigationPane :smileyfrustrated:.

 

I didn't get the right dataModel object because of a scope problem on ListItemComponent that I am describing in the bug I gave the link.

 

Sorry for the confusion.

Please use plain text.