options in drop-down list

Hello

I need assistance with options in the menu dropdown.

How can I do something like this: if (something)-> show some options in the menu dropdown.   If (Something Else)-> show some other options.

I don't know if it's possible in QML but in C++, I guess it would be something like the next piece of code

DropDown *myDropDown = root->findChild("objectNameOfMyDropDown");

if(something) {
    myDropDown->add(Option::create().text("Option 1"));
    myDropDown->add(Option::create().text("Option 2"));
    myDropDown->add(Option::create().text("Option 3"));
}
else {
    myDropDown->add(Option::create().text("Option 4"));
    myDropDown->add(Option::create().text("Option 5"));
    myDropDown->add(Option::create().text("Option 6"));
}

If you want to change the content when the user clicks on a button, you can listen for this event and use the dropdown-> removeAll() method to clear all options. Then just fill the ComboBox with combo-> add(Option::create().text("Option"));)

I hope that this message has helped a little further.

Tags: BlackBerry Developers

Similar Questions

  • Content-aware lack of options in drop-down list of selection of filling [in PSE12]

    No matter what I do, how many times I reboot or even look for answers when I use the Select Content-aware tool, subtract, fill selection - I can't find the selection that supports the content in the drop-down list selection of filling. I am only offered foreground color, background color and color on all guides in Adobe also shown is Content-aware.  I have PSE12 and don't know what to do next?

    Content Aware in the selection of fill is only in photoshop elements 13 and newer.

    Photoshop elements 12 is not aware of content in the selection to fill dialog box.

  • Command to refresh a calculated field when you select an option from the drop-down list box

    When my form user selects an option in a drop-down list box, the value in the field (in this case, Total) I would like to update, but it isn't.

    A radio button option box makes the Total-development field to automatic update when the user clicks on the radio button. But the drop-down list box is not updated Total (without clicking away from the field). I would like to add a command in the Combo Box to refresh the Total field when you selected the option to drop-down list box.

    Someone at - it a code (Javascript?) to get there.

    Thank you very much.

    You don't need a script, simply select the 'Value selected to validate immediately' checkbox on the Options tab of the dialog list box drop-down list box field properties.

  • Width of drop-down list and the number of drop-down list values

    How to increase / decrease the width of a drop-down list on the screen of your interview? In addition, how you increase the number of menu options drop-down user, some of my options in drop-down list don't show up. This shows only 3 points:...

    For OPM 10.4:

    Increase the number of visible items in a drop-down list

    There are two options:

    1. make a regular drop-down list instead of a list of drop-down list box. Regular drop-down lists always display all items, regardless of the length of the list. To do this, set "enable-search-comboboxes = false" in the appearance.properties file. "

    2. increase in the search results max for the combo box in the file appearance.properties, for example 'search max-results = 20' (or another number as appropriate)

    See article OPM the User Guide for more details: http://docs.oracle.com/html/E54499_01/toc.htm#Interviews%20and%20flows/Customize_Web_Determinations.htm#Change4

    I have a vague memory that the increase in the width of the drop-down lists is a bit more tedious. I'll take a look and post here...

    See you soon,.

    Jasmine

  • Configuration drop-down list when you request an action plan

    Because we are not allowed to the VCAC SDK, I am forced to use the workflow integrated calling my master workflow VCO.  My problem is that I have just rated provision which limits me to expose my configurations for each model.  An example of what I need is sales will have 40 configs while Finance has 10 configs.  I don't want their options in drop-down list to bleed over to other.

    Any ideas?

    Thank you

    -Stephen

    Well well, without knowing your particular use case and what are the variables, then Yes, maybe. I have more than 70 IaaS models right now, but I have ~ 20 profiles of construction. Nothing gets actually configured in the action plan itself except for material-specific values and model of vSphere being used for the provision of... All the news of real form is in building profiles. It is much easier to control that.

    At one point, I thought together to the bottom of each environment in a single model and have the o/s to be a configurable drop-down list, but finally I decided against that because I'm driving both the metadata information to be recovered vCAC and operate only vCO as a runtime engine. I wanted that little data hardcoded / fixed stored in vCO as humanly possible, so I build battery funding round have as much of the required inputs be stored in vCAC or vCenter, keeping the absolute minimum in vCO.

    Useful?

  • in the 'history' drop-down list, there is an option to "restore the previous session. I want to remove this option completely.

    I speak no crashes or my home page. I'm talking about the option in the history drop-down that allows anyone who comes behind me to restore my session, after I'm gone.

    COR - el, I read several threads with this question, and you always seem to post these links. I don't think you understand the question properly. I read the first link you posted, and the most relevant element has been 'store session completely disabling. so I went in: config, and did what I was told. I set the preferences browser.sessionstore.max_tabs_undo and browser.sessionstore.max_windows_undo to 0. it does not work. After that, I close firefox and reopen. in the drop-down list in the history, there's always an option to restore previous session, I click on it and it restores session.

    Diego, your response is not what I was hoping. I want to stay signed in the pages I frequent. like gmail, youtube, ect. your solution sign me out of everything every time. Thus, although technically it works, this is not the option I want to use. but after tinkering with the options in this section I figured it for everyone with my same worries:

    go to: Tools > options > privacy, in the 'history' pane, select 'clear history of firefox closing', click on settings for this option, select "Browse and download history.

  • Why the back button isn't a drop-down list to go back multiple levels in Firefox 4? Y at - it an option to reactivate the which?

    Before that I've upgraded to Firefox 4, the back button (as it is in all other browsers under the Sun,) had a drop-down list so you could spend a layer of back up and fall back on several levels. This is particularly important when there is a site you redirecting and you cannot go back only to back single click. However, FF4 is not-at least not by default - and I do not see anywhere in the options to add. Is he hiding somewhere I didn't, or that has been deleted?

    You need to click on and hold the back button or do a right click to access the menu drop down.

  • How to dynamically add an Option in the drop-down list?

    I have this code:

    {Drop-down list

    ID: list

    Title: 'list '.

    onCreationCompleted: {}

    opion var = new Option();

    opion. Text = "Hello";
    opion. Value = 4;

    List.Add (opion);

    }

    }

    After the launch of the application, the list is empty.

    Why my code does not work?

    It is easy to dynamically add options

    first add this to your attachedObjects:

    ComponentDefinition {
                id: optionDefinition
                Option {
                }
            }
    

    then do something like this

    var newOption = optionDefinition.createObject()
                newOption.text = ...
                newOption.value = ...
                newOption.description = ...
                newOption.selected = ....
                yourDropDown.add(newOption)
    
  • Add options from a drop-down list of c ++

    In my C++ files, I have a QMap to data that I want to add a drop-down menu that I have in QML.

    I can't find examples of how to add options to a menu already existing but.  Here's what I have in my file QML right now:

    DropDown {
                        id: account
                        title : "Account"
                        enabled : true
                    }
    

    It seems it should be a fairly easy process to get the id of the drop-down list and enter the data of my inside QMap.

    Any help with this would be greatly appreciated!

    Oh, I didn't see that you do not know how to connect the logic of C++ to the UI QML, the ID of the component QML is not enough, you must set objectName: property 'dropDown' too.

    You can reach any CPP QML object like this:

    This excerpt comes from YourProjectName.cpp
    create the active document of the main.qml scene
    Set parent document created to ensure that there is overall
    application lifetime

    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);

    Create the root for the UI object
    AbstractPane * root = qml->() createRootObject;
    game created the root like a scene object
    App-> setScene (root);

    and here's the findChild method
    Drop-down list * dpList = root-> findChild ("combo");

    After this line, dpList will point to the controller of the user interface.

  • dynamically load the Options in a drop-down list in C++

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

    First, drop the:

    dpList->setSelectedOption(0);
    

    Not only if it is not necessary, but it will explode your application if the function is called when there is already no options in the menu dropdown.

    Also, do NOT delete the task, because it is still owned by the datamodel. I also see that you use type casting C, which just blindly accepts your cast, even if it's a mistake. Instead, if you know for sure what kind it will be this way instead:

    Task* myTask = static_cast(myObjects[i]);
    

    If you are not sure if the type you are casting the is the type you need, use the dynamic_cast instead:

    Task* myTask = dynamic_cast(myObjects[i]);
    

    The advantage of this more static_cast , is that if you try to perform a type cast is not compatible, then myTask will be set to NULL.

    Alternatively, Qt offers a replacement for dynamic_cast which works on platforms where is not regular C++ casts.

    Task* myTask = qobject_cast(myObjects[i]);
    

    It is functionally equivalent to dynamic_cast, but as I said, it works on all platforms that Qt exists, whereas dynamic_cast cannot.

    Once you did get back to us.

    oddboy wrote:

    Hey guys,.

    I'm trying to dynamically load items Option in a drop-down list by using C++.  I have a function in my class of WorkManager file that does the trick:

    QStringList WorkManager::getListOfItems() {
        int i = 0;
        QStringList taskNames;  // used for debugging mainly, so i can print the list out to debug
        QList  myObjects = m_model->toListOfObjects();
        DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild("scriptListDropDown");
        if (dpList != 0 ) {
            dpList->setSelectedOption(0);
            dpList->removeAll();
            for (i = 0; i < myObjects.size(); i++) {
                Task * myTask = (Task *) myObjects[i];
                taskNames.append(myTask->taskName());
                dpList->add(Option::create().text(myTask->taskName()).value(myTask->command()));
    //          delete myTask;  // do I need to delete the task object?
            }
    //      qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames;
            return taskNames;
        } else  {
            qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0";
            return taskNames;  // empty list
        }
    }
    

    I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.

    However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes.  calling the function above a second time anywhere in my application appears to hang the application immediately.

    I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.

    It seems down right when I do dpList-> removeAll().

    I also can't seem to find the right place to call this function to an object of type in my class.  I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:

    app->setScene(root);
    

    in the applicationui.cpp file.  Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.

    is there a better way to do it?  .. and make it safer?  I can't understand how to do this.

    Thank you!

    J

  • drop-down list new folder option is no longer on the desktop

    Hello dare how Yall are

    I got a few Yes troubel

    drop-down list new folder option is no longer on the desktop

    I don't know what to do dat

    Thank you Sha

    You have installed chrome? It is an update of Chrome, (mid), is responsible. Here are two patches.

    How to remove and restore the default context Menu items 'New' in Windows 7 and Windows 8
    http://www.SevenForums.com/tutorials/28677-new-context-menu-remove-restore-default-menu-items.html

    If still no joy, see the 'response' by Linda Yan in this thread.
    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/thread/97de8a2a-12f2-4381-A409-a78f4ae551cf/#99395761-56de-4a76-8C2A-eab498ad735a

    Tip: When you save the text in Notepad, the default file format is .txt. Replace all files.

  • drop-down list - option line break

    Is it possible to add a line break to a drop down list?

    Or change the width of the drop-down list when the user clicks to view the options?

    Some of the text I have is very long and you can't read it all.

    With the help of this question, I could get this job.

    https://forums.Adobe.com/message/2208564#2208564

    Displaying the XML Source Code and adding
    to produce a carriage return.

  • Network option just is not in the drop-down list under the definition of the property

    I have a vRA 7 installation and am trying to create a drop down menu option to choose VLAN while deploying VMS from the Blue Print.

    To do this, have created a property definitions as below.

    Capture.JPG

    Then I had created a group of properties like below

    PG.JPG

    Then to Blue Print Custom property and added the Group of properties and property custom added the VMNetwork

    When I return to the catalog and deploy a new virtual machine can't see any vlan in the dropdown option menu.  instead I see the preset in the menu drop-down

    pg3.JPG

    Why the drop-down list values Vlan do not come up instead of this the name value appears.

    If mistaken. any help appreciated

    Try like this:

    The property group is like the old building profile, a way to group several properties. You must specifically that he would do that.

    Grant

  • How to use a function switch box to the reference that is used several times in the previous drop-down list options?

    I use JavaScript coding in LiveCycle and development of dependent drop-down areas, but I find it difficult to write correct code. See the example below. I'm trying to use a multiple box function that refers to an option that is listed several times in the previous pull-down menu. The problem I am running into is that when I refer to any color or Nissan and Chevy, it returns the results of the color in the "Ford" column only. I'll always see color (blue, black, green and purple) options in my second drop-down list and it seems fine, but then the third drop reference only the options and colors 'Ford '. (I don't have the code for the third menu list drop-down).

    I want the client to choose Chevy or Nissan and have her drop downs (based on the color they chose)-dependent, but I can't seem to make this work.

    I hope it is clear enough (probably as mud...). I would appreciate help!

    Form1. #subform [0]. #subform [1]. cboModels::exit - (JavaScript, client)

    cboColor.clearItems ();

    {Switch (this.) RawValue)}

    case "Ford":

    cboColor.addItem ("Blue");

    cboColor.addItem ("Black");

    cboColor.addItem ("Green");

    cboColor.addItem ("Purple");

    break;

    case 'Chevy ':

    cboColor.addItem ("Blue");

    cboColor.addItem ("Black");

    cboColor.addItem ("Green");

    cboColor.addItem ("Purple");

    break;

    case "Nissan":

    cboColor.addItem ("Blue");

    cboColor.addItem ("Black");

    cboColor.addItem ("Green");

    cboColor.addItem ("Purple");

    break;

    }

    Form1. #subform [0]. #subform [1]. cboColor::exit - (JavaScript, client)

    cboPrice.clearItems ();

    {Switch (this.) RawValue)}

    case "Ford":

    case "green":

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    break;

    case 'Chevy ':

    case "green":

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    break;

    case "Nissan":

    case "green":

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    cboPrice.addItem ("blah");

    break;

    }

    You can use '\n' for newline in a string, so

    "Option 1, \nOption 2, \nOption 3;

    Put each on its own line.

    Bruce

  • I have one drop-down list box where one selection (options) is the other.

    I have one drop-down list box where one selection (options) is the other. If a user selects the other, I want to conceive the possibility for them to enter some Notes to describe their other. A pop-up window or the text box is possible? Do not know how to approach the issue... Thank you!

    The field in parentheses is the text (or drop-down menu or other) you want to display when "Other" is selected and hide when it is not.

    If you want to apply the same logic to several fields just duplicate this line of code, the field name in each copy of setting.

Maybe you are looking for