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: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T
Accepted Solution

How to Pass a string from one .qml to another .qml?

Hi Guys,

 

How can I pass a string from page1.qml to page2.qml using BB 10 Cascade?

 

Thanks

 

Shwarup

Thanks,

Shwarup Biswas
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: How to Pass a string from one .qml to another .qml?

You can use property. Say

a.qml

... ignore ...
b.abc = "123"
nav.push(b)

b.qml

property string abc

...ignore..

Label {
    text: abc
}

 




p(^_^)q
Good good study, day day up
Developer
Posts: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T

Re: How to Pass a string from one .qml to another .qml?

 

 

Hi,

 

Please find my code bellow. b.qml display blank. Am i missing any ting here?

 

 

a.qml
*****  
              onTriggered: {
                    clearSelection()
                    select(indexPath)
                    var newPage = pageDefinition.createObject();
                    navigationPane.push(newPage);
                }
                onSelectionChanged: {
                    b.abc = _app.selectionChanged(indexPath, selected);
                }

 

in b.qml:

 

import bb.cascades 1.0

Page {
    property string abc
    Label {
        text: abc
    }
}

 

  

Thanks,

Shwarup Biswas
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: How to Pass a string from one .qml to another .qml?

Can you change this line to a hard coding value for debug purpose?

 

b.abc = _app.selectionChanged(indexPath, selected);
->
b.abc = "something"



p(^_^)q
Good good study, day day up
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: How to Pass a string from one .qml to another .qml?

onTriggered: {
                    clearSelection()
                    select(indexPath)
                    var newPage = pageDefinition.createObject();
                    navigationPane.push(newPage);
                }
                onSelectionChanged: {
                    b.abc = _app.selectionChanged(indexPath, selected);
                }

->

Can you have a try with the following methodology

onTriggered: {
                    var chosenItem = dataModel.data(indexPath);

                    // Create the content page and push it on top to drill down to it.
                    var b = detailPage.createObject();

                    // Set the title and source of the feed that the user selected.
                    b.abc= chosenItem.xxx
                    navigationPane.push(page);
                }



p(^_^)q
Good good study, day day up
Developer
Posts: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T

Re: How to Pass a string from one .qml to another .qml?

Hi Javayoung, I tried with hard coded value but still the b.qml page is blank.
Thanks,

Shwarup Biswas
Developer
Posts: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T

Re: How to Pass a string from one .qml to another .qml?

Thanks Javayoung. It is working. I mistaked in object reference.
Thanks,

Shwarup Biswas
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: How to Pass a string from one .qml to another .qml?

Yes, me too. I always miss something at the beginning of BB10 development.




p(^_^)q
Good good study, day day up