How to dynamically create a tab?

Hello everyone.

I try to use the native SDK rather webworks, and I'm sometimes difficulties.

I'm creating application with typical scheme:

ListView-> TabbedPane-> ListView

(List of collections-> tabs for models-> view model)

If the user selects an item in the first posting of the list I so need the tabs, but if the user selects another one I need other tabs.

Unfortunally tabbedPane controls don't dataModel property. It is only from the listView.

So, I create Datamodel and manually load the XML with tabs:

TabbedPane {

    id: tabbedPane
    showTabsOnActionBar: false

    attachedObjects: [
        GroupDataModel {
            id: dataModel
        },
        DataSource {
            id: dataSource
            source: "/data/list.xml"
            onDataLoaded: {
                var items = data.listItem;
                for (var i in items){
                    var tab = new Tab({title:items[i].name});
                    tabbedPane.add(tab);
                }

            }
        }
    ]

The data is loaded with success, but bb.cascades is not Builder for tab!

I see some builders for Button, Label, and other controls, but 10 to 15 controls mybe created by other means?

I know how it resolves in C++, but I want to know - perhaps QML-method exist?

Are you sure it's a good idea? If you have a large number of items, which will create a better user experience, I think.

That said, if you know you have does not exceed a certain number of elements and, therefore, tabs, you can create them in advance in your QML and add them (or remove) to your TabbedPane to give a dynamic effect.

See https://github.com/blackberry/Cascades-Community-Samples/blob/master/PasswordSample/assets/main.qml#... for an example where I've done it myself.

Hope that this help somehow small.

Martin

Tags: BlackBerry Developers

Similar Questions

  • How to dynamically create variables of StationGlobals who are LabVIEWIOControl

    I'm looking for a way to dynamically create variables StationGlobals LabVIEWIOControl.  I know not how to create variables through "PropertyObject/SetValXXX", however I have some difficualty create variables that are custom data types.

    Thank you

    Bryon

    Bryon,

    You can use an expression as follows:

    StationGlobals.NewSubProperty("MyVariable",PropValType_NamedType,False,"LabVIEWIOControl",0)

    I hope this helps!

  • How to dynamically create action item?

    Hi, I want to dynamically create point.

    Before I want to create using qml, but does not seem possible

    http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-create-action-item-of-page-dynami...

    So maybe better to use C++ to create dynamically,

    I'm already try but are still not

    So I have a custom control qml (a Navigation pane)

    name List.qml

    the structure is like this:

    NavigationPane {}

    {Page}

    objectName: myPage

    {Of container

    ....

    }

    }

    }

    How to add action item to this .qml?

    I'm already try that, but failed

    C++ :

    Engine QDeclarativeEngine;

    QDeclarativeComponent component(&engine,QUrl::fromLocalFile("List.qml"));)

    QObject * object = component.create ();

    Page * myPage = object->findChild ("Edit");  Maybe, on that note, I'm wrong implemented? -> not found?

    ActionItem * action1 = ActionItem::create () .title ("first action");

    my page-> addAction (action1, ActionBarPlacement:nBar);

    Remove the object;

    How to create this dynamic Action item?

    Help, please

    Thank you

    Hello

    QML, the object name must be included between "" marks.

    Name of the object of your Page will be:

    objectName: "myPage"
    

    You can reach any CPP QML object like this:

    This excerpt comes from YourProjectName.cpp

    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole
    // application lifetime
    
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        app->setScene(root);
    
    //and here comes the findChild method
    Page* qmlPage = root->findChild("myPage");
    

    After this, you can create any object on the side of C++ QML, as your own code:

    ActionItem* action1 = ActionItem::create().title("First action");
    myPage->addAction(action1, ActionBarPlacement:nBar);
    

    Don't have no need to create a QObejct, or declarative stuff.

  • How to dynamically create table names?

    I need to dynamically create arrays with array variable names.

    for example, something like this:

    for (var n = 0; n < nodeContainer.length; n ++) {}

    nodeObj = nodeContainer [n];

    var name: String = nodeObj.nodeID;

    table [name]: Array = new Array(); will create the table as "arrayName?

    }

    How?

    Although MovieClip is a dynamic class, classes that extend it DO NOT INHERIT of dynamic features.

    You'd become a big favor if you read the documentation:

    http://www.Adobe.com/LiveDocs/Flex/201/langref/statements.html#dynamic

    To be a class dynamic it must be explicitly defined as such. In your case, it should:

    SerializableAttribute public class dynamic couple extends MovieClip

    And, even once, you REALLY need to understand the AS3 syntax. I'm sorry for you teaches, but despite suggestions you insist on doing bad, although solutions are presented in the clearest way possible.

    The line var myObject ["v_" + VNAME] = new Object(); is a total nonsense in terms of syntax. If you have read my previous message (s), you must write it this way:

    var myObject:Object = new Object();

    ["v_" + VNAME] myObject = new Object();

  • "Open all in tabs" reuses the existing tabs, how do I create new tabs instead?

    I have a few folders of bookmarks on my bookmarks toolbar. When I clicked on 'All open tabs' on one of those which I was surprised to see that he reused tabs I have what I've lost everything, I looked into these tabs. I want to create and use NEW tabs. How can I configure it to do this?

    Please use Tab Mix Plus.

    Read our help page

    If you have further questions visit our Forum

  • How to dynamically create a structure of data?

    When forming the link select I use linkedselect.js library. For her, it was required to form the structure of data in the following format:

    syncList1. dataList = {

    "list1" : {'0':'------','1':'Yes','2':'Now'} ,

    "list2" : {'0':'------','1':'Now','2':'Yes','3'}

    };

    There is an array of values from XML files containing all the necessary information ("list1", 0,'-', 1, ' Yes, 2, 'now') etc. In a cycle that I try to create this structure, but does not work, it is not an object and a line of text

    Good, but how can I used array LIST with linkedselect.js?

    This is worked sample Edit fiddle - JSFiddle

  • How to dynamically create a movieclip from an image

    Hello!

    Developer Java im in transition to AS3, my task is to create one of these spaceship games (beathazard / Asteroids style) but I'm already destroyed by the differences between these languages... im trying to make this game completely through AS3, in other words, attempts to avoid manual configuration as much as possible, at the moment, im trying to create my space ship (an instance of my class of spacecraft) , my experience (my class staged instance), my balls (ball class instance) and my game (game class).

    The first problem im having is that I can't seem to turn the ship find his sprite when running its constructor in order to create a new instance of it and add it to my game (in fact, my staging).

    No matter what ideas of how to do this? IM using this constructor:

    public function Nave() {
    
    
    var imgLoader : Loader = new Loader();
                   imgLoader.load(
    
    new URLRequest("../img/normalShip.png"));
    
    
    this.addChild(imgLoader);}
    
    
    
    

    and then just create an instance of this ship on my game and adding that a child of my game.

    Thanks in advance! Any advice will be very welcome!

    If you want to add the image to a MovieClip or Sprite, you will have to wait until the image is loaded before doing so.  Wait for what it assign you an event listener COMPREHENSIVE in the loader's contentLoaderInfo property.  Once it's loaded, you can have the process of function event handloer the Loader.content (image) in some object that you intend to have it in.

  • How to dynamically create a text entry

    Hello

    I need to create a dynamic text.
    I use the following code but its nt working

    OAMessageTextInputBean oamessage = new OAMessageTextInputBean();
    oamessage.setLabel ("Table name");
    oamessage.setMaximumLength (30);
    oamessage.setID ("TableId");

    Can ny body share your thoughts

    Thank you
    Nani :)

    Hello

    Changed the code

    ' Public Sub createbeans (pageContext OAPageContext, OAWebBean webBean)
    {
    OAMessageTextInputBean oamessage = (OAMessageTextInputBean) createWebBean (pageContext, MESSAGE_TEXT_INPUT_BEAN, null, "text");
    oamessage.setPrompt ("Table name");
    oamessage.setMaximumLength (30);
    webBean.addIndexedChild (oamessage);
    }

    DONOT CHANGE use as it is...

    Thank you
    Gerard

  • How to dynamically create a symbol within a symbol

    I have a symbol called "Table" on the stage and referenced like this:

    var table = sym.getSymbol ("Chart");

    I have a symbol in the library called "blueRect" that contains a single element called 'bar '.

    I want to create an instance of 'blueRec' t in the graphic symbol and then set several properties of the element 'bar '.

    The following code works great to create a symbol on the stage, but as soon as I change 'Stage' to the 'picture' to try to create it in the graphic symbol, it does not work. (The code executes, but nothing seems to happen.)

    pmt1 var = sym.createChildSymbol ("blueRect", "Stage");

    PMT1.$("bar"). CSS ('height', 100);

    PMT1.$("bar"). CSS ('width', 25);

    PMT1.$("bar"). CSS ('top', 50);

    PMT1.$("bar"). CSS ('left', 25);

    I don't know that it's probably a stupid syntax error... Any help is greatly appreciated!

    Carolyn

    I know little or nothing on board, but what if you capitalized the first letter of the table to the 'picture' instead of 'table '?

  • Dynamically create headphones...

    Hello

    I have an external swf that I load into Flash and try to achieve communication between the swf file and the charger of the parent.

    In the external swf file, I have a series of events, they are preparing based on that frame the user is enabled, i.e.:

    dispatchEvent(new Event("1"));
    dispatchEvent(new Event("2"));
    dispatchEvent(new Event("3"));
    

    I am trying to create a generic listener function that will add several eventListeners to the scene based on an arbitrary number that will listen to turn for the events that they are preparing the external SWF, as follows:

     function ListenForNavFromExternalAsset(sectionLength:int):void
    {        
        for(var i:int = 0;i<sectionLength;i++)
        {
            var screenNum = '"' + i + '"';
            stage.addEventListener(screenNum, NavToScreenFromExternalAsset, false, 0, true);
            trace(screenNum);
        }
    }
    

    I can see followed by the screen, so I know that the service is running.

    However, clearly, the events are not added to the scene because I never see the traces below, even if the external swf is no doubt sending its events:

    function NavToScreenFromExternalAsset(e:Event):void
    {            
        trace("ADDED_TO_STAGE");
        if(e == Event("1"))
        {
            trace("NavToScreenFromExternalAsset: ONE");
        }
        else if(e == Event("2"))
        {
            trace("NavToScreenFromExternalAsset: TWO");
        }
    //etc..
    }
    

    There must be a better way to do what I'm not aware of, I had a lot of success in the past using dispatchEvent and capture the event, but I don't know how to dynamically create headphones and listen to a dynamic channel.

    If anyone can suggest a way forward, I would be much obliged.

    Thx for reading,

    ~ Chipleh

    Hi Ned,.

    Thank you very much for the reply and oooh, it looks nice, I'll put it in my Pocket Flash for future use.

    After a lot of writing and rewriting and realize (as usual) I was overloading the question, I came up with it, that solved my problem:

    In one of my functions running, I create the number in which I want to listen to

    Add it to the event listener

    for (var i: int = 0; i<>

    {

    var thisScreen:String = String (i + 1); ([/ /, false, false, 1]);

    addEventListener (thisScreen, NavToScreenFromExternalAsset, true);

    }

    Then in the event listener, I get the event type, apply it to my screenCount variable,

    my function call and I'm good to go

    function NavToScreenFromExternalAsset(e:Event):void

    {

    screenCount = int (e.type) - 1;

    DisplayLessonScreenContent();

    }

    However, that being said, the custom event class that you posted is much more elegant, where the solution is just a simple hack. Anyway, thanks for your message of Ned and a lot of satisfaction to you, my friend.

    ~ Chipleh

  • How to create graphic tabs in front of Panel?

    How to create graphic tabs in front of Panel? How can I use tabbed indicators in the front panel?

    Drop a control tab on the front.

    Move a chart on a tab.  You can add multiple pages of tabs by clicking on the tabs.

  • I am trying to create dynamic landing pages that reflect the locations of my Google ads. How can I create a dynamic text on my landing page to specify the location in the title?

    I am trying to create dynamic landing pages that reflect the locations of my Google ads. How can I create a dynamic text on my landing page to specify the location in the title?

    Thanks a lot for your answer. I've sorted it now.

    Kind regards

    Gill

  • How to create Mulitple tab in the Page

    Dear all,
    How to create Mulitple tab in the Page (UI)

    One way is to download the OA Framework Metalink Dev guide. You can also navigate to Jdevdoc (under your Jdev installation) and find the index.html file. There you have the reference to the Dev Guide. You can get the right information here too.

    Concerning
    Sumit

  • When I create a new tab and enter the URL for a site already called on another tab, instead of download the new site in the new tab Firefox switches to the tab with the site already called up. How to disable "switch to tab"?

    How to disable "switch to tab"? Why? The site that I want to turn a Java program, and I want the program to run several times. I looked in tools > Options > tabs and found no way to disable the switch 'tabs '. I looked through the Options together and found nothing. I thought tools > Options > advanced could hold the key to a solution, but I found nada.

    You can turn it off by using the switch to tab no Add on more - https://addons.mozilla.org/firefox/addon/switch-to-tab-no-more/

  • How can I create a tree for a flex definition tab?

    I have several tabs in my content tree and I want to show the user specific tabs to specific roles.

    The problem is, for example, the active product is the cell subtype and sub-type tablets and I want to create a tab to display a few cell phones to a user with the role A and I want to create a tab to display a few tablets to a user with the role of B.

    Thank you for your help.

    I ve found I can only create treetabs for parents to flex and not definition of flex.

    Solved my problem

Maybe you are looking for