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

Posts: 14
Registered: ‎10-04-2010
My Device: Not Specified

weird dropdown / color bug

in some code I was working on, I've found some weird behaviour with dropdown qml.

If I have the following qml snippet:

DropDown {
id: color1
title: "Choose Color"
                        Option {
                            text: "Red"
                            value: "red"
                        Option {
                            text: "Yellow"
                            value: "yellow"

and then try to access color1.selectedValue , i will get "#ff0000" or "#ffff00", not "red" and "yellow" as I would expect. if i switch the value in the Options to "solidRed" and "solidYellow" then I get the string back as is. i can obviously work around this in the way i choose my colors, but seems significant, particularly if dropdowns are user-defined - and not wanting to stumble upon any magic values. any confirmation as to what's going on here? or is there something in qml that I'm missing that makes this happen?

(note, this is in sdk

Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: weird dropdown / color bug

I think this is similar to HTML/JavaScript/CSS.


For simplicity the user (developer) can input colors in clear named values... "Blue", "Red", "White" etc. but that's all it is... a way to easily set colors...


but internally the system uses actual RGB color values (it likely converts the values when setting them)... thus when inspected or script requests the set color... you get the HEX value instead.


#ff0000 is red

#ffff00 is yellow

#0000ff is blue


etc, etc.

PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****