Read the dynamically created objects

Hello

I get my feet wet with development of Cascades, and I was hoping someone here could answer some questions I had.

I am defining a container that contains a drop-down list and a zone of textfield and I need to repeat this containing three more times. I thought by using the ControlDelegate class to create three instances without writing the code three times. However, I don't know how I'd read the value of each instance of the drop-down list and the ControlDelegate textfield.

Any Suggestions?

If you instantiate the like this:

Container {
    property variant control1
    property variant control2
    property variant control3

    id: rootContainer
    Label  {
        text: "Example Component Definition"
    }
    Button  {
        text: "Click to create dynamic component"
        onClicked :  {
            // Create the component and add it to the Container
            control1 = compDef.createObject();
            rootContainer.add(control1);
            control2 = compDef.createObject();
            rootContainer.add(control2);
            control3 = compDef.createObject();
            rootContainer.add(control3);
        }
    }
    attachedObjects: [
        ComponentDefinition {
            id: compDef
            textfield { id: text }
        }
    ]
}

Then components are accessible as control1.text, control2.text etc.

If the number of objects is constant, then ControlDelegate might be more convenient.

For ListView, you can use ArrayDataModel or GroupDataModel (for more complex models with sorting) and fill it with any type of data. Any kind of items can be added, it's just a picture of QVariantMaps. It is not necessarily Xml or SQL wrapper, but specialized models also exist for this. It is even possible to create a subclass of DataModel custom c++ to expose existing data objects.

Tags: BlackBerry Developers

Similar Questions

  • Name of the instance and dynamically created objects on the screen

    Through ActionScript, I created three clips on the screen and gave them names item1 and item2, item3. How can I now the x and is coordinated (or any other property) of these objects? For example, simply trace (item1.x) doesn't seem to work.

    I read the other posts on this topic and I still don't understand.

    you add these sodas to Bobin, not sodaC. (and use the attach code to view the code in this forum).

  • Time of design and of the dynamically created controls

    I have a project written in VC6 as a project of the MFC dialog box. In a particular area, I dynamically create several (the exact number depends on user input) CNiGraphs. There is also a two CNiButtons that were created at design time using the resource editor. The problem I have is that when this dialog box is open, a message appears saying it is an eval version and the control will go off after 5 minutes. After 5 minutes of waiting, the CNiButtons 2 go inactive (black tower), but the continuous CNiGraphs of work. I have a valid license of MStudio 8.1.6, version but it seems that these 2 buttons do not recognize the license. There are also other buttons from the moment of conception of the project, but these have no problem at all. When you create the dynamic creation of the CNiGraphs, give them a valid license string, and I was wondering if there is a problem with the time created and dynamically controls created in the same dialog box to design. Anyone know?

    I don't remember, but I can have created these 2 CNiButtons when I was with only an eval license. (All others were undoubtedly create when I got a full license) Could have an impact on them? I have a vague memory of reading somewhere that DTC create controls to check the license when they are created in the designer and store that info in them license. If this is the case does anyone know an easy way to update the license stored in control? I rather not just delete it and Add again because I would avoid having to redo the tab order (unless someone knows how to easily insert something in the middle of the order of tab instead of having to click through all the controls in the correct order)?

    In addition, I don't know if this would affect anything, but the project was originally built with ComponentWorks 1.0, we were forced to move to MStudio when we met a few bugs in CW, so all controls were originally CW controls which have been converted into control of CNi. I doubt that this is so like everywhere else, we changed during controls is not a problem, but I'm ready to try the suggestions.

    Hi JC,.

    I hope you had a good weekend!  I'm glad to hear that you're back running.  Add the extra button was, in fact, causing update the licensing information for the other buttons, as you can imagine.  After further research, I found that the license information are stored only the form of the control, and if this control doesn't change in any way (or in your case, adding a new project), he sees no reason when compiling to recreate a link to the license.  However, after the change of control and a new, it updates the link between the license information, which solved this problem in your case.

    I hope this helps, JC.  Have a great day!

  • How to calculate the dynamically created cells?

    Hello

    Please can anyone provide us with a simple code to calculate the cells created dynamically using Add button line?

    Thanks anyway

    Header
    1Quantity [1]
    2Quantity [2]
    FooterTotal

    Hello

    Write this script on the Calculate the value TotalAmount field event (using FormCalc):

    $.rawValue = Sum(parentRowName[*].Amount.rawValue);
    

    Hope this will help you.

    Thank you.

    -

    Afonso

  • Changing the property of all the dynamically created MCs at the same time

    I have a list of dynamically created MCs.  I have this function, which works very well:

    function onLoaded(e:Event):void {
    
         xml = new XML(e.target.data);
         var il:XMLList = xml.channel.item;
         var listItems:Array = new Array();
         for (var i:uint=0; i<il.length(); i++) {
              listItems[i] = new list_item_mc();
              listItems[i].x=0;
              listItems[i].y=i*60;
              listItems[i].list_txt.text = il.description.text()[i];
              listItems[i].addEventListener(MouseEvent.CLICK, listItemClick);
              addChild(listItems[i]);
         }
         
    }
    
    function listItemClick(e:MouseEvent):void {
         e.currentTarget.list_txt.setTextFormat(highlightText);
    }
    

    However, I would like to have this setTextFormat command be run on the list_txt text box in ALL dynamically created MC any ONE of them is clicked on.


    How to achieve this?  The number of dynamically created clips may change at any time, is not a defined number.

    Thank you!

    If you declare the array listItems outside the functions, you can access in your event handler function so that you can loop through it similar to the way you already do in the onLoaded function.

  • Reading XML data into the dynamic text object

    XML... < Quesiton > there is a long line of text from the XML file. < / Question >

    I have an XML file that I've read in a long line of text. I tried to format the string of information with a line break. Have tried to use < br / > and setting the text as htmlText and works except there is an empty line between the sentances. Tried to use the \n and affecting the text object just text, but that brings the \n in the text string.

    Any suggestions how to make text coming to have a line break?

    Well guess what? I've just entered my code and added in my XML CDATA, as I had done before but this time it worked! GO figure... Thanks for the suggestion.

  • Change the scope of the qml created object

    My main QML, I call another qml using

     attachedObjects: [
        ComponentDefinition {
            id: splash
             source: "splash.qml"
         }
    ]
    

    I create the splash to help screen

    var splashSheet = splash.createObject();
    splashSheet.open();
    

    Now I want to change a label on this object.

    I exposed the label using an alias of the property.

    As long as the variable is in scope, I can use

    splashSheet.stateLabel.text = "new text"
    

    How can I do this in another function where I can't access the var splashSheet without creating a new object?

    One option is just to set a property of type variant in your component root (or any other place the two pieces that can access), store a reference to the object is. That is, "mySplash variant property" and when you create, retain a reference with "mySplash = splashSheet", and then later to use 'mySplash.stateLabel.text' to achieve this.

  • What is the default user name and password of the dynamically created edge NSX gateway?

    Hello

    I created a NAT device on request and as part of it, but an edge gateway. What is the default user name and password to connect to the edge device?

    Thank you

    Pankaj

    I do not know the password by default, but you can either define easily. Just go to the network security &--> NSX edges, select your edge, click actions and identification of Climate change information. You can also enable SSH from there.

  • to access the dynamic created clips



    I can't access the clips for the application of measures.

    photAmount, thumb1xpo, thumb1ypo and sm_photo are variables.
    thumbLdr is an mc holding the mc which are created. I know that they are created as they show their respective photos. I can't apply all actions.

    Thank you



    THANK YOU VERY MUCH!

    You and your House can be blessed.

  • How to read the object space analytical Java work, when it is in reconstruction?

    Is Hi possible to save the OLAP object java so that it can be read, even if it is in reconstruction?
    so when I have reconstitute the AW (analytic workspace), the other user can still read the old AW object while waiting for the new object AW is built

    I even try to create 2 AW, while I create 1 AW, I try to read another AW in the same database schema
    but then the process of reading for the second AW is to hang until the creation of the first AW is finished
    is there somehow so that the process can occur at the same time without waiting for the process of construction is finished?

    A second user should be able to access an AW even while it builds as long both users have different sessions - OracleConnection instances in terms of jdbc. It is not enough to use two Threads Java, sharing the same connection.

  • How do you add a 3D object in a dynamic 3D object layer?

    Sorry if this is a duplicate. I asked this before, but it seems to have disappeared into the ether...

    I created a layer to smart object 3D with a Cup, handle, coffee and steam, all in the same scene. Later, I created a saucer, but I did it on a normal 3D layer, and not on the smart object layer. I can't understand how to move the saucer in the dynamic 3D object layer, so I can add it to the stage. Copy / paste does nothing and I can't merge the layers.

    Thank you!

    I don't know if you can.  You can double-click on of course on the layer to smart object to reopen the 3d layers in Photoshop add the 3d saucer layer then merge the layers 3d, restore their coordinated 3d object then positioning and resizing the parent to another. When record you the dynamic object works the original smart object layer file will be updated by Photoshop and now contain the saucer.

  • Dynamically create and assess controls.

    I have an ArrayCollection collection in my application that I use to dynamically create controls for.  Each row of the table must create four controls.  The following code is what I used to create the items.  Problem is that I don't know how to evaluate when the time comes to deal with the values entered in each control.

    for (i = 0; i < model.) BudgetDetails.length; i++){
    If (i > 0) {}
    offset = offset + 25;
    }

    var TmpName1:Label = new Sun;
    TmpName1.text = modΦle. BudgetDetails [i]. BudgetCategory;
    TmpName1.name = "Label" + i;
    TmpName1.x = 5;
    TmpName1.y = offset + 6;
    TmpName1.width = 200;
    TmpName1.styleName = "LabelRightAlign";
    addElement (TmpName1);

    var TmpName2:TextInput = new TextInput();
    TmpName2.text = modΦle. BudgetDetails [i]. BudDesc;
    TmpName2.name = "Input_BudDesc" + i;
    TmpName2.x = 215;
    TmpName2.y = offset;
    TmpName2.width = 200;
    TmpName2.styleName = "TextInput_Desc";
    addElement (TmpName2);

    etc...

    }

    It works very well to create the controls, but I don't know how to loop through the controls to find the values entered into the TextInput controls.  I have to either assign names to controls before I create or I need to know how a loop on all of the items on my page.

    Well, it is not the most elegant solution out there, but it does not work...

    Code to delete the dynamically created controls *.

    var MyNumElements:int = numElements;          numElements decreases every time you delete an element

    var x: Object;

    var CurrentElement:int = 0;                              elements becomes the they are deleted

    for (i = 0; i< mynumelements;="">

    x = getElementAt (CurrentElement);

    TMPNAME = x.name;

    TMPNAME = tmpname.substring (0, 5);

    If (tmpname == 'Label' | tmpname == "Input") {}

    removeElementAt (CurrentElement);

    } else {}

    CurrentElement = CurrentElement + 1;

    }

    }

    Enter code to inspect the text controls *.

    for (i = 0; i< numelements;="">

    x = getElementAt (i);

    TMPNAME = x.name;

    TMPNAME = tmpname.substring (0, 5);

    If (tmpname == "Input") {}

    DoMyStuffHere

    }

    }

    Deletion of items was a little complicated numElements declines because by one whenever you remove an item that mess up your loop counter.  Also items get becomes the they are deleted.  Please also make sure that all THE OTHER ELEMENTS on your form are not named with the same string as the most dynamic. In my case, I named everything with Labelxxx or Input_xxx if all the other names had ti be assigned.  For example, I had a few other labels in my module so I had to name them.  Oh... an id is not the same as a name either!  (learned that the hard way...)

    If you have any suggestions on how to make code that dynamically adds, removes or inspects more elegant controls, please let me know!

  • Why CC 2015.1 allow me to work with the vector Smart Objects?

    Since the update, I was unable to use the dynamic vector objects to switch between Photoshop and Illustrator. I can bring things manually, one to the other, but I don't like having to relocate my vectors whenever I need to change. This seems to be a step backwards if Adobe has intentionally disabled this.

    I double click on the vector layer in Photoshop and she usually opens in Illustrator, I rather get a "Script alert" which said "it is not directly editable in Photoshop, but it can be placed in a document. To move the item, drag and drop it into an open document. "Like I can't drag and drop a layer in Illustrator to make changes, that is not really do me much good.

    If anyone has any information on how to resolve this problem on a PC which would be amazing,

    Thank you!

    Hi Kartoffelpoofern,

    Please visit the following link: error: this item is not directly editable in Photoshop

    Kind regards

    Tanuj

  • By program (step by step) read data XFDF and dynamically create the form

    Hej,

    I have a form created dynamically with JavaScript in Adobe Acrobat 9. I exported the variable amount of data in an XFDF file.

    Now, I want to import the XFDF file into a second PDF file. But while the data is variable, I need to read the data imported manually

    and to create the new PDF dynamically. This is required, while the new PDF must contain a chart made in Flash and will be

    filled with data from the XFDF file.

    My problem is, that "doc.importAnXFDF ()" does not return the data that is imported as an object. I was looking for solutions

    but I have always found solutions to automatically populate an existing form. The API guide is not useful. Where can I read the imported data

    to iterate on and in the process.

    Thank you very much.

    Christian

    As I discovered (https://acrobatusers.com/tutorials/extracting-pages-pdf-acrobat-javascript) it is possible to save a range of

    pages programmatically. In fact, this has many advantages for my use case, including to prevent the many errors made by users.

    So I decided to use this solution and close this issue.

  • How to read the objects and collections dynamically?

    Hello
    I want to read database/collection objects dynamically. Please advice!
    Here is an example

    Create the user as an object type (name varchar2 (100), number (3)) of the age
    /

    create a family of fonts as a user table
    /

    I want to do something like this

    DECLARE
    user of the var;
    BEGIN
    ...
    ...
    SELECT "family (1)" INTO var FROM DUAL;
    ...
    ...
    END;
    /

    Thank you

    As I suggested, you can define your own method of "diff" for the object. You haven't told us exactly what form you would like to work to take. I'll define a (pretty useless) function which will just create a string that tells you how to modify the data of an object to match the data in another. Obviously, you would like a more useful output. Potentially, rather than a member function, you can choose a procedure Member who emits DML is required for the underlying table is necessary.

    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE OR REPLACE TYPE location_typ AS
      2  OBJECT
      3  (
      4    building_no NUMBER,
      5    city        VARCHAR2(40),
      6    MEMBER FUNCTION diff(
      7                l location_typ)
      8    RETURN VARCHAR2
      9  )
     10* ;
    SQL> /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE OR REPLACE TYPE BODY location_typ
      2  AS
      3    MEMBER FUNCTION diff(
      4      l location_typ)
      5    RETURN VARCHAR2
      6    IS
      7      l_diff_str varchar2(4000);
      8    BEGIN
      9      IF building_no != l.building_no THEN
     10        l_diff_str := 'Building_no needs to change from ' || building_no ||
     11                         ' to ' || l.building_no;
     12      END IF;
     13      IF city != l.city THEN
     14        l_diff_str := l_diff_str ||
     15                        'City needs to change from ' || city ||
     16                          ' to ' || l.city;
     17      END IF;
     18      RETURN l_diff_str;
     19    END;
     20* END;
     21  /
    
    Type body created.
    
    SQL> DECLARE
      2    loc location_typ;
      3    secloc location_typ;
      4    a NUMBER;
      5  BEGIN
      6    loc    :=NEW location_typ(300, 'San Francisco');
      7    secloc :=NEW location_typ(200, 'Redwood Shores');
      8    dbms_output.put_line( loc.diff( secloc ) );
      9  END;
     10  /
    Building_no needs to change from 300 to 200City needs to change from San
    Francisco to Redwood Shores
    
    PL/SQL procedure successfully completed.
    

    Justin

    Published by: Justin Cave on 9 April 2012 14:12

Maybe you are looking for