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
nhuanvd
Posts: 21
Registered: ‎12-11-2012
My Device: Blackberry Z10

dropdown: set selected

[ Edited ]

I have a DropDown,

DropDown {
    title: "Font size"
    Option {text: "abc"; value: "abc";}    //1
    Option {text: "def"; value: "def";}    //2
    Option {text: "ghi"; value: "ghi";}    //3
    Option {text: "jkl"; value: "jkl";}      //4
    Option {text: "mno"; value: "mno";}//5
}

If i have a value, how can i set a option (contain that value) as selected.

   ex: how to set the 2nd option if i have value "ghi"

or How to get a list of value of this DropDown?

 

sorry about my english. :smileysad:

 

 

Developer
guignards
Posts: 18
Registered: ‎06-19-2012
My Device: Bold 9780 + 32GB Playbook, Dev Alpha B & C

Re: dropdown: set selected

Some Clarification,

Are you wanting to change the value of the drop down to the second option via another input component?

Or are you just looking to get the value out of the dropdown from the selected option.

 

have you looked over the documentation for the dropdown box?

http://developer.blackberry.com/cascades/reference/bb__cascades__dropdown.html

 

Try looking for your answer in here if you haven't already.

Developer
nhuanvd
Posts: 21
Registered: ‎12-11-2012
My Device: Blackberry Z10

Re: dropdown: set selected

Yes, I want to change the value of the drop down to an option via another input component?

InputDropdown value
abcthe first option
jklthe fourth option
mnothe fifthoption
Developer
Developer
klz
Posts: 132
Registered: ‎08-24-2011
My Device: Z10 LE + Playbook

Re: dropdown: set selected

You can use setSelectedIndex(int index)

 

The index must either be in the range of [0, count() - 1] or SelectedIndexNone. Otherwise, it is ignored. Passing SelectedIndexNone deselects any selected option.

The selectedIndexChanged()selectedOptionChanged(), andselectedValueChanged() signals are emitted, if the selected index is changed.

Parameters
index

The index of the option to select, or SelectedIndexNone to deselect any selected option.

Thank you!
----------------------------
My Apps: Alchemy Game | Image Resizer | Jam! | Traffic Signs: USA | Radio Record
My Blog: http://bb10pro.com