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.

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 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();

  • 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

  • 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 and destroy the custom menu item

    I have a standard TestStand platform that I use on multiple systems.  On some systems, I have a few sequences of calibration and I would like to have the Update menu to have the RunSequence of these sequences of calibration.  I know how to manually create these menu items, but they are no longer valid for some sequence files.  I would use the sequence SequenceFileLoad to dynamically create menu items and the SequenceFileUnload to destroy these menu items.

    I've played around with the API, but cannot determine the correct path to get to the create and destroy the custom menu items.  Does anyone know how this can be done?

    Thank you

    Matthew

    Yes, see the online help for the members of the following APIs:

    Engine.GetEditTimeToolMenuItems

    EditTimeMenuItems

    EditTimeMenuItem

    Basically, you get a collection of tool using Engine.GetEditTimeToolMenuItems () menu items and then call EditTimeMenuItems.Insert () or EditTimeMenuItems.Remove (). If you insert a you get returns an EditTimeMenuItem object on which you can change the settings.

    In addition, since it has an expression to hide items in menu tool, you need not necessarily to destroy, you can hide them instead.

    Hope this helps,

    -Doug

  • 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 get a dynamically created symbol delete itself-click?

    Here is the configuration...

    I want to have a dynamically created symbol to appear on click of a hotspot. In this case, you click on a thrilling hotspot and a popup appears.

    Here is the code I use for this.

    Create an element in the instance of a symbol as a child of the given parent item

    var mySymbolObject = sym.createChildSymbol ("gardern_toxins_popup", "stage");

    So we have the symbol 'garden_toxins_popup' in my library placed dynamically on the page. I would like to assign an action to the pop-up itself which allows you to remove the symbol from the stage to click.

    I feel stupid for not be able to understand this. I tried iterations of this piece of code...

    Download the scene compared to the level of the composition, get the symbol

    sym.getComposition () .getStage ().getSymbol("garden_toxins_popup").delete ();

    .. .but it does not work.

    So I tried to think as if I was back in Flash and tried the following...

    this.parent.removeChild (this);

    But no joy on that as well. Is there something that I have not touched on in this logic, or I go about it the wrong way? Thank you!

    Sorry I meant: sym.deleteSymbol ();

    In symbols, you must:

    sym.getComposition () .getStage () .play (0);

    sym.deleteSymbol ();

    You can see all the code in the code window.

  • How do I create a Wizard of action as both copies and highlights the text?

    Hello

    This may show that I am not a very experienced user, but that's it. How do I create a Wizard of action as both copies and highlights the text? I want to make a tool that does both, but when I try in Action Wizard I don't see these editing options.

    Help appreciated.

    See you soon,.

    Michael

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Prof. Michael A. Gilbert

    Coordinator computer SCIENCE

    Department of philosophy

    424 Ross S

    [email protected]

    f; Coco

    Is not possible.

  • How can I create a library item in the latest version of dreamweaver CC?

    How can I create a library item in the latest version of dreamweaver CC? I want to save my Start menu and my right foot of author as part of the library but can not find a way to do it.

    Switch to the design view or Code view, and drag the selection to the active panel library category.

  • 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 t o create breadcrumbs in flash 5 action script 2.0 use cs?

    How t o create breadcrumbs in flash 5 action script 2.0 use cs?

    If the user is throungh go some buttons then there's finally breadcrumbs on the last stage (as it is selected 1, 2 or 3 buttons etc...) and then final should display last used button.

    Besically am looking for bread crumbs. Can anyone know how to create breadcrumbs with the help of the movie clip? or any other code?

    Can someone help me?

    Use swfaddress: http://fcontheweb.com/articles/swfaddress_as2/

Maybe you are looking for

  • Need old bios version 4.0 or 4.1 for Satellite P100

    I tried now to update my bios on 4.2 32 bit However, this result without DECO fan in windows.My good warm sound.SpeedFan said about 100 degrees Celsius. If someone don't know where I can download older versions of bios.I have a PSPA3 satellite P100-2

  • Sound crackling of the new Satellite L500-1XC right speaker

    Hello I bought a new Toshiba laptop yesterday and started from today afternoon, but since then, I have my speaker crackling noise right I want to know if there is any problem or it s due to moisture.

  • HP ProBook T6P01ET G3 450: DigitalPersona Personal instal windows 10

    I want to install DigitalPersona Personal on my HP ProBook G3 T6P01ET, but I can't find it anywhere. can anyone help my?  

  • Presario CQ57: windows does not

    My laptop did not... As I started my laptop its starts but nt load something you seem just the clock on the toolbar... Not a work one button... I tried the ctrl + alt + del bt nt works...I'm in trouble... Please guys help me to solve this problem...

  • What advice to post cRIO related issues?

    Mr President. What advice should I post cRIO regarding Questions and doubts about my application with cRIO. Please help me already that I posted in motion control readers that my application is related to the command of the engine using cRIO.bu, I ge