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
Trusted Contributor
smjose
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor
Accepted Solution

Dropdown list item access

Hi,

 

I have a dropdown list in my app. I have done that in my QML file. Now, on clicking a button in the page, I should get a pop up asking the confirmation of the item I selected from the dropdown list. How can I get the item I selected in the list and display it ? can someone help pls 

 

thanks

Please like this if you are answered.
Please use plain text.
Developer
simon_hain
Posts: 15,863
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Dropdown list item access

https://developer.blackberry.com/cascades/reference/bb__cascades__dropdown.html#property-selectedopt...
as a property you can reference it in qml with a dot, so myDropDownId.selectedOption
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Trusted Contributor
smjose
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: Dropdown list item access

[ Edited ]

Thanks .. I tried it and it shows an error like " selectedOption() does not return a value. Please check my code here..

        Button {
            text: "submit"
            translationY: 670.0
            scaleX: 0.9
            scaleY: 1.0
            translationX: 210.0

        attachedObjects: [
            SystemDialog {
                id: dialog
                title: qsTr("Confirm!")
                body: qsTr(" Card Number ") + cardNoText.text + qsTr(" Option ") + dropdown.selectedOption()+ qsTr(". Continue?")
                onFinished: {
                    if (dialog.result == SystemUiResult.ConfirmButtonSelection) _myexample.showSuccessMessage();
                }
            }
        ]
        onClicked: {
            dialog.show()
        }

 Actually this gets crashed even when I dont use the dropdown id.

Please like this if you are answered.
Please use plain text.
Developer
simon_hain
Posts: 15,863
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Dropdown list item access

no brackets. it is a property, not a function/method.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Trusted Contributor
smjose
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: Dropdown list item access

Oh .. ok.. thanks alot.. but as I said, it crashes when I run the progm.. if I remove this attachedObjects block from the code, it works fine. Anything is wrong in this code? 

Please like this if you are answered.
Please use plain text.
Trusted Contributor
smjose
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: Dropdown list item access

[ Edited ]

 Never mind.. I resolved the crash by adding  "import bb.system 1.0" in the qml file.

 

thank you..

 

Please like this if you are answered.
Please use plain text.