Access a drop-down list component created in fom runtime C++

Hello everyone.

I included a file "Settings.qml" as a ComponentDefinition in my file "main.qml" as follows:

*******************************
main.qml
*******************************

Page {
    id: page

    //App menu
    Menu.definition: MenuDefinition {
        settingsAction: SettingsActionItem {
            title: "Settings"
            imageSource: "asset:///icons/ic_settings.png"
            onTriggered: {
                var settings = settingsSheet.createObject(_cam);
                settings.open();
            }
        }
    }

    //Main container
    Container {        Camera {            id: cameraQML            objectName: "cameraQML"        }    }

    //Attached objects
    attachedObjects: [
        //*****this is the component definition****
        ComponentDefinition {
            id: settingsSheet
            source: "Settings.qml"
        }
    ]
}

Then, in the "Settings.qml" file, I have something like that.

On the crack of onCreationCompleted I call you access of wich C++ function to the cameraQML component and gets the available resolution values and add them to the drop down list component.

***********************Settings.qml***********************

Sheet {
    id: settingsSheet
    objectName: "settingsSheet"
    peekEnabled: true
    content: Page {        Container {            DropDown {
                title: "Capture Resolution"
                objectName: "resolution"

                options: [
                    Option {
                        text: "16:9"
                        value: 16/9
                    }
                ]

                onCreationCompleted: {
                    _cam.loadResolutionValues();
                }

                onSelectedValueChanged: {
                    //_cam.selectResolution(selectedValue);
                }
            }
        }    }}

The PROBLEM comes when I try to access the menu item drop down because, even if I get error when you call the function findChild(), I do when I try to add Options by calling the add() function:

******************applicationui.cpp******************

AbstractPane* root;Camera* cameraQML;DropDown* resolutionsDD;

void AppliactionUI::ApplicationUI() {    //code...    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);    qml->setContextProperty("_cam", this);    root = qml->createRootObject();    cameraQML = root->findChild("camera");    //code...}void ApplicationUI::loadResolutionValues() {
    QVariantList reslist = camaraQML->supportedCaptureResolutions(CameraMode::Photo);
                //**I don't get error by calling this function
        resolutionsDD = root->findChild("resolution");

        //**The app do crashes when calling any of these three functions
    //resolutionsDD->setTitle("Choose an option");        //resolutionsDD->removeAll();
    //resolutionsDD->remove(resolutionsDD->at(0));    for (int i = 0; i < reslist.count(); i++) {
        qDebug()<<"QVatiant value:"<add(Option::create().text(res.width()+"x"+res.height()).value(reslist[i]));
    }
}

I thought it was a problem with the type of value, I was put in the service. value() when you create an option, but then I realized that, while trying to change the title from the drop-down list, or delete i ' ts options that the application crashed also.

This makes me think that the problem is that I'm not a correct reference for component drop-down menu QML due to the fact that this drop-down list does not exist when the application starts and is created until the user opens the Settings.qml file. Also, I think that this is a problem with all that stuff parent and child, but of course, it's just a feeling.

I'd really appreciate your help on this type of problem. I'm not experienced enough to know what is the right way to get a reference of work to the drop down list component in question in a situation like this

Thank you very much in advance!

P.D. I'm sorry, I know that my English is not very good. Hope you do not misunderstand

Hello
Very probably findChild returns NULL and a NULL pointer dereference causes the crash. I remember there was problems with findChild during the use of the leaves.

Try from the drop-down list directly to the function as an argument:

(1) in applicationui.cpp:

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

Add:
    // This is needed for passing DropDown in function parameters from QML to C++
    qmlRegisterType("bb.cascades", 1, 0, "DropDown");

(2) modify the function declaration for:

Q_INVOKABLE void loadResolutionValues(bb::cascades::DropDown *dropDown);

(3) in QML:

DropDown {
  id: dropDown
  ...
  onCreationCompleted: {
     _cam.loadResolutionValues(dropDown)

     // _cam.loadResolutionValues(this) // maybe this will also work, but I haven't checked

  }
}

Tags: BlackBerry Developers

Similar Questions

  • I disabled the menu and cannot access the drop-down list to get back them

    I disabled all the menus to make a screenshot and now I can't access the drop-down list to get back them

    This has happened

    Just once or twice

    is today

    You can hide the menu bar in Firefox 3.6 on Windows, on "view > toolbars" or via the contextual right click menu on a toolbar.
    Press in and hold the Alt key to display the menu bar.
    Go to "view > toolbars", right click on the menu bar, or press Alt + V T to select the toolbars to show or hide.

    See also what happened to the file, edit and view menus?

  • How to change the color of the text on the user interface control, such as the drop-down list component

    Hi, I want to change the color of the text in drop-down list because I want to set background color.

    How to do this?

    Thank you

    He suggests as a feature on jira. or write a custom, component drop-down list does not support this.

  • Modification of the properties-type def drop-down list box

    I have a group of 32 cases of a def type. The def type contains several different types of control. What I have to do is to change the properties of the list box for each of the type defs. Normally, I would create an array of references to change the properties for each of the type defs, but when I try this I can not access the properties of string [] for combo box selections. The only way I found to fix it is to create a reference for each individual drop-down list box item. It is labour, since I'll have 32 elements. Is there a way to beeter to do this? The first screenshot shows the issui I'll have, not being able to change the properties of specific elements within each of the def type at runtime through a control [] array. The second screenshot shows the only solution I've found so far, which is not very practical.

    You will need to set up (for a more specific class) control to a type of combo box for the particular control [] index that has the combobox control if you want to access the drop-down list.

    You can also access the combobox in a cluster based directly, rigth click on the control reference and a link to the element cluster directly.

    The last option is to make the strictt of typdef will fill all instances with the channel list [] given that it is a strict property.

    the approach is based on the weather, you plan on changing the list during execution.

  • Using Wizard of the Action to change the font in the drop-down list box

    Acrobat Pro DC on a MAC under OS X 10.11.6

    I have a form that is mainly created in Indesign (it works for us - I know that others prefer to locate forms purely in Acrobat).

    I have a script I can run through the wizard of the Action (run a javascript script) to change the font in all fields in text form. But being a novice script that I can not understand how to create a similar script that will change the font used by drop-down list boxes (created in Indesign). Is it possible by a script?

    I know I can do it manually through the properties, but if someone can give me a pointer to find a way to do it with a script that would be amazing!

    Thank you

    The script can be changed to:

    for (var i = 0; i)< numfields;="" i++)="">

    var f = getField (getNthFieldName (i));

    If (f.type = 'text' | f.type = "combobox") {}

    f.textFont = "Arial";

    f.textSize = "10";

    }

    }

    But now I have to ask, what are your reasons to use Arial instead of Helvetica?

  • Crushed DB access drop-down list

    I created a data connection (printers) to an Access DB and I also have a drop-down list that reads the fields of the database.  I put the overall binding that I want the shortname to be selected printer and the printer description to be in default of the abbreviated name. However when the form is signed and emailled to a recipient, the value in the drop-down list returns to the first value in the database. I have no default set on the value tab.

    Found the problem, in the data connection, change the properties of the ADO to ' delayed open.

  • editable drop-down list - something line in Access

    Hi all

    I'm trying to convert a MS Access application to APEX. In the access application, there is a text field with a dropdown list. The application of populating drop-down list is the following:

    SELECT DISTINCT CARS. Model CARS CAR BUYING. Model;

    As I understand it, it will allow me to select one of the existing values in the menu drop down, but also add a new simply by typing the value in the field its self.

    Is there such an option with APEX? It seems that drop-down lists in the APEX are created based on the data static or dynamic, is there a simple way to add new values to the list?

    Thank you for your time,

    DanielD

    Hello Daniel,.

    You can use a PopUp LOV selection of existing models. If you enter a different model for a car that is added to the Table of cars, and will be available for the next use of the context menu.

    Greetings,
    Roel

    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.Logica.com/

  • create the mailing list option missing from 'File', 'New' drop-down list in the 38.3.0 version

    Hi all

    I'm trying to create a mailing list using the steps described in the online documentation, but the "Mailing List" does not appear in the fly-out drop-down list. What I am doing wrong?

    In addition, what is the best way to import a mailing list I have in Eudora?

    TIA

    straysaver

    Thank you for your response. New list appears, under address book.

  • create a drop-down list

    It would be possible to create a drop-down list to the fields of an external database or excel file?

    TKS

    Make sure your form is a form dynamic XML, if you do not find why you cannot connect to the data source share your form... There must be something that you are missing.

  • How to create the drop-down list?

    I tried to find a way to reach this menu drop down animated and I can't.  I'm somewhere between (animation using the accordion panel and the substitution effect the composition).

    Any help would be appreciated.  It is the example of what I'm trying to achieve.

    Retired military community Washington DC | Hawks landing

    Thank you!

    Hello

    You can create the same drop-down list using the ToolTip Widget composition but the only way that you can add on turnover and deployment will be discoloration.

    Please check the attached file. http://adobe.ly/1IxxKfO

    Another alternative is to create a lively border animation and use it in Muse as a file OAM.

    Concerning

    Vivek

  • Create a secondary named calculation in a repeating subform based on a drop down list?

    Hi all

    I need a little crazy script. Not sure it is even possible.

    What I have:

    1. repeating subform SummarySub amounts
      1. calculation at the end of the form TotalOver field gives the total dollar amount of all iterations of SummarySub

        so far, so simple. but then:
    2. I need another, repeating the SubRow subform at the end of the form to give to other total:
      1. based on the drop-down list the name of the originator in SummarySub
      2. and break out the totals of all iterations of SummarySub based on payer such as chosen by the user names.

    Ideally, the subform (the principal totals) (B) at the end of the form would add instances as the user leaves the field name of the payer. I was not able to find a way to make and to keep the value in the field (name of the payer) of the additional instance.

    All this makes sense?

    I'll appreciate any help.  I'm trying to learn more about JavaScript in LC, but my bills just keep coming...

    Thank you very much

    Laura

    Dropbox - AFBS_OverpaymentReport_121914.pdf

    Hi Laura,

    Take a look at the modified version of your form, https://sites.google.com/site/livecycledesignercookbooks/home/AFBS_OverpaymentReport_01011 5.pdf? attredirects = 0 & d = 1.  I added a subform called PayerTotals, which has a summary of insurance created in his event to calculate.  The code looks like.

    var oFields = xfa.resolveNodes("SummarySub[*]"); 
    
    var nNodesLength = _SummarySub.count; 
    
    var nSum = 0; 
    
    var insuranceCompanies = {}
    
    for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) { 
    
     var item = oFields.item(nNodeCount);
    
     if (!item.InsuranceCompany.isNull && !item.OverpaymentAmount.isNull) {
    
     if (insuranceCompanies[item.InsuranceCompany.rawValue]) {
    
     insuranceCompanies[item.InsuranceCompany.rawValue] += item.OverpaymentAmount.rawValue
    
     else {
    
     insuranceCompanies[item.InsuranceCompany.rawValue] = item.OverpaymentAmount.rawValue
    
      nSum += item.OverpaymentAmount.rawValue; 
    
    totalover.rawValue = nSum;
    
    _PayerTotal.setInstances(0);
    
    for (var insuranceCompany in insuranceCompanies) { 
    
     var payerTotal = _PayerTotal.addInstance();
    
     payerTotal.InsuranceCompany.rawValue = insuranceCompany;
    
     payerTotal.totalover.rawValue = insuranceCompanies[insuranceCompany]; 
    

    Hope this helps

    Bruce

  • Is it possible to create interactive drop-down lists that reference the tables on pages separate from the PDF?

    I'm looking to create a user to input PDF in the drop-down lists are used to search for tables, however, I'm not very familiar with the options that are available or if this is even possible?  Also, is it possible to write a substantive code that could read the text of the user entered to perform a search or even solve an equation? Can someone let me know if these elements are possible and/or let me know what adobe program may be required to accomplish these tasks? Thank you!

    PDF documents have no concept of "tables" as MS Word or MS Excel has. There is content that looks like a table.

    Acrobat JavaScript knows tables and form fields. So we could have a table in JavaScript and complete a series of fields that looks like a table. You can use JavaScript to find the table.

    JavaScript in Acrobat can accept user entries in the fields and pop-up windows.

    It is possible to solve theoretical equations the user if the good rating or coding is used.

    D.P. Story is an evangelist generated LaTex PDF to create PDFS with mathematical symbols, and he also created the AcroTex product that allows to create educational tools that includes mathematics calculation self placement tests.

  • Create a dynamic drop-down list field in Adobe Acrobat Pro XI

    Hi all. I am creating a field in one of my forms using Adobe Acrobat Pro XI. I have a drop down list of 'core' items, and according to what is selected in the list, I want a second drop-down list to give different choices. I've searched and searched and have javascript that I thought might work, but maybe I'm have a mistake or I'm place javascript code in the wrong place, because it does not work. I know very, very little about javascript, any help would be so appreciated.

    I use Adobe Acrobat Pro XI. I added a "new field" and selected "drop-down list. The domain name is ProvType. The options of the menu drop-down are:

    Hospitalized patients

    External consultations

    Doctor

    I have "Commit selected value immediately" selected. The field is not validated. The format is 'none '. There is no measures or calculations associated with it.

    I then created another dropbox and named SubProvType. Under Actions, I selected the trigger as the mouse upwards and then selected the Action "executes a JavaScript script. I selected the Add button and he hit in the JavaScript editor:

    Switch (ProvType.rawValue)

    {

    case "Hospitalisation":

    this.setItems ("Hospice, hospital, Nursing Facility");

    break;

    "outpatient": case

    this.setItems ("adult day Center, Home, others");

    break;

    case 'doctor ':

    this.setItems ("surgeon, general practitioner, neurologist");

    break;

    }

    What I want to do is:

    If "Hospitalization" is selected, I want only the following options to be available in the second drop-down list box "SubProvType":

    Palliative care

    Hospital

    Nursing facility

    If "outpatient" is selected, I want only the following options to be available in the second drop-down list box "SubProvType":

    Adult day Center

    Home

    Other

    If the 'doctor' is selected, I want these options to be available in the second drop-down list box "SubProvType":

    Surgeon

    Family practice

    Neurologist

    However... when I close form editing and try to select a different option in the ProvType field, SubProvType field is left blank and there is no options available. Also, there are no errors.

    I must be missing something, but I have no idea where to start. Thank you in advance for any help anyone can provide.

    Use this code as the ProvType custom validation script (and remove any code that you have associated with SubProvType):

    switch (event.value) {
        case "Inpatient":
            this.getField("SubProvType").setItems(["Hospice,Hospital,Nursing Facility"]);
            break;
        case "Outpatient":
            this.getField("SubProvType").setItems(["Adult Day Center,Home,Other"]);
            break;
        case "Physician":
            this.getField("SubProvType").setItems(["Surgeon,Family Practice,Neurologist"]);
            break;
    }
    
  • I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. How can I fix?

    I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. Can I fix?

    I am fairly new to this, but I think it has to do with the way you have drop them downs named. Copy you a then keep stick in each area? If so, that's the problem. You must rename each with a different number: Dropdown1, Dropdown2, etc. I think this might solve the problem.

  • How to create the drop-down list, as in the generator of the APEX?

    Hello

    I use the theme 2. I would like to create a drop-down list as in Apex Application Builder, where, on top, you see home | Application Builder | SQL workshop. When you click on one of them, a menu drops down.

    Is it possible to do with standard APEX or I have to do some Javascript coding?

    Tamas

    Hello
    I have them tested again, as I'm new to apex and that I am in the process of upgrading my knowledge by reading books and documentation on the apex, but you may be interested in these plugins
    located @ http://www.apex-plugin.com/

    * [url http://www.apex-plugin.com/oracle-apex-plugins/region-plugin/warp11-css-menu_85.html] Warp11 CSS Menu *.
    * [url http://www.apex-plugin.com/oracle-apex-plugins/region-plugin/drop-down-menu_60.html] Drop-Down Menu *.
    and my favorite
    * [url http://www.apex-plugin.com/oracle-apex-plugins/region-plugin/jquery-menu_82.html] jQuery Menu *.

    Hope this helps

    Concerning
    Jean-Yves

Maybe you are looking for