Dynamic component and layoutProperties for DispositionAbsolue

In my QML app, I have a 'Tile.qml' where I defined a custom component.

It works fine when I create explicitly (as shown in the example below), but I'll have 24 tiles that I don't want to create manually.

// This is main.qml

NavigationPane {
    id: app
    property int tiles: 16
    property int tileSize: 192
    property int rows: 4
    property int columns: 6

    firstPage: Page {
        id: pgMain
        content: Container {
            id: root
            layout: AbsoluteLayout    {  }

            // Tile 1;  uses "Tile.qml" declaratively
            Tile {
                text: "1"; tile_x: 0; tile_y: 0
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 0
                    positionY: 0
                }
            }...

I added the following to main.qml to take into account the components of creating dynamic NFB tile:

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

        onCreationCompleted: {

            var newTile = component_Tile.createObject(  );
            newTile.text = "7"
            newTile.tile_x = 0
            newTile.tile_y = 0

            root.add( newTile );

        }

I works great for adding a tile, but here's my problem: in the "declarative" version, I defined the absolute location of the tile in the container by adding the following to the object of the tile "layoutProperties: AbsoluteLayoutProperties {positionX: 0 positionY: 0}.

Now, I don't know how to do it (specifiyng the obtions of page layout to place the component in absolute positions in its container) during the creation of the conponent dynamically!

Is there a way? Am I missing something?

Your help is greately appreciated!

-jlb

I made some experiences and this code seems to work, even without the alias:

hand. QML

// Navigation pane project template
import bb.cascades 1.0

Page {
    Container {
        id: root
        layout: AbsoluteLayout { }
    }

    onCreationCompleted: {
        for (var i = 0; i < 4; ++i)
        {
            var newTile = component_Tile.createObject(  );
            newTile.text = "TEST" + i;
            newTile.layoutProperties.positionX = i * 150;
            root.add(newTile);
        }
    }

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

Tile.QML

import bb.cascades 1.0

Label {
    id: label
    text: qsTr("Label")
    layoutProperties: AbsoluteLayoutProperties { }
}

UPD:

Discovered another interesting thing...

If you don't want to force the tile to have DispositionAbsolue, so what follows will also work:

hand. QML:

newTile.layoutProperties = Qt.createQmlObject('import bb.cascades 1.0;AbsoluteLayoutProperties{}', newTile, 'main.qml');
newTile.layoutProperties.positionX = i * 150;

This line may be withdrawn from Tile.qml:

    layoutProperties: AbsoluteLayoutProperties { }

UPD 2:

Found an even easier way:

attachedObjects: [  ...,  ComponentDefinition {
    id: absoluteLayoutPropertiesFactory
    content: AbsoluteLayoutProperties {}
  }]
...
newTile.layoutProperties = absoluteLayoutPropertiesFactory.createObject(newTile, {});
newTile.layoutProperties.positionX = i * 150;

UPDATE 3:

Just to be complete, the components of Qt Quick work too.

import QtQuick 1.0
...
attachedObjects: [  ...,
  Component {
    id: absoluteLayoutPropertiesFactory
    AbsoluteLayoutProperties {}
  }
]
...
newTile.layoutProperties = absoluteLayoutPropertiesFactory.createObject(newTile, {});
newTile.layoutProperties.positionX = i * 150;

Tags: BlackBerry Developers

Similar Questions

  • Apex: button to add dynamic date and user for the article page

    [warning... post newbie]

    I have a simple table of questions and actions.

    users change/update records using the form on a table with the report.

    There is a comments column to record the latest updates; users must add their name and the date at the top.

    I am currently using a button that calls a dynamic action to execute javascript to insert the date and the user at the top of the text in the field comments (UPDATES_NEW_ON_TOP)

    problems:

    1 Insert date works on firefox/chrome but not IE

    2. can't seem to find the right code to insert the currently logged in user name

    extract javascript below...

    Notes:

    -After reviewing the packaged applications I see more elegant ways to do this but we are going the long way to learn stuff

    -the JavaScript below is probably very poorly formed - apologies if it upsets anyones sensitivities of coding

    -open to any means to achieve the desired result

    beer on me for any assistance that you can give

    var d = new Date();

    var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",]

    "Jul", "Aug", "Sep", "Oct", "Nov", "December"];

    document.getElementById("P3_UPDATES_NEW_ON_TOP").innerHTML =.

    d.getDate () + ' - ' +.

    monthNames [d.getMonth ()] + ' - ' +.

    "" d.getFullYear () + ": [ID] +.

    String.fromCharCode(0)) (13) + string.fromCharCode(0)) (13) + P3_UPDATES_NEW_ON_TOP.value;

    ;

    Thank you all for your contributions and redirects

  • dynamic distribution and an order for various devices of construction

    I have a code that is written on a device. The device will be changed, but perform the same basic (frequency setting, power etc) commands. So, I wrote a dynamic dispatch VI that takes a command string predefined and written to the appropriate device based on what communication mechanism is used (SNMP, VISA, etc.). My question is related to the predefined command string that feeds this VI. I think that the creation of the chain of command VI should also be dynamic distribution and should build the command appropriate for the given device. But some devices might have several parameters required for the construction of this string (for example, snmp) and something like VISA may not be only one parameter. Dynamic distribution screw must have the same connector components, so what is the best way to handle this? I thought about having a class of 'settings' in the connector pane that holds all the specific parameters for a device. But it seems exaggerated to make a class for something like this, when a variant would do the trick as input. However, having a variant as it tends to make me think of distribution dynamic is not necessarily the right choice in the first place because you force a similar connector component.

    I also consider if some necessary inputs are, in fact, the State of the object and that it could be found in the object itself. This would reduce the connector pane entries and can mitigate some of these problems all together.

    Thoughts?

    for (imstuck) wrote:

    I also consider if some necessary inputs are, in fact, the State of the object and that it could be found in the object itself. This would reduce the connector pane entries and can mitigate some of these problems all together.

    That's what I'd do. Make settings of the object data, so when you then call the function to generate the dynamic distribution VI command string has all the right data available to it.

  • ImageSnapShot and dynamic component

    Hello world!

    Is it possible to take a snapshot of a component generated by an actionscript class?

    This works when the component is already created, but when I try to generate a component and then to take the snapshot, I get a black square instead of the snapshot of the component...

    Thank you

    Of course, if the component is created, it is possible.

  • Delete a dynamic component created with QML?

    Hello

    How can I keep the reference to the created object, for example to remove it later.

    In the example below the reference "createdControl" is stored in a local variable of Manager 'onClicked' and is not accessible afterwards.

    It is not possible to use a property of the container to store, because then I need to specify a data type (curiously its possible to store it in a javascript imported the file into a variable typless...).

    Therefore this reference seems to be pretty useless at the moment, or did I miss something?

    Thank you.

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

    OK, the right kind of data is 'variant', sorry, I searched for an hour, just found

  • Dynamic selection of images for OBIEE 11 g report

    Hello dear colleagues,

    need help to solve a problem with the dynamic selection of images for reports OBIEE 11 g.
    For OBIEE 10 g, it works perfectly - put images in

    *'\ < HOME_ORACLE_BI > \web\app\res\s_oracle10\images'*

    Directory and enter edit the column formula (in the answers) of the expression:

    * ' < table_name > '. "" < table_column > | ". jpg'*.

    and selecting

    URL of the image (in the properties of column-> Data Format)

    retrieve the images appropriate for the corresponding model (the project is for fashion retail customer) regarding the description of the specified column (for example * "DM_ITEM".) «MODEL_CODE ' ('09361' = *) put correspondence the name of the image file (* '09361.jpg' *).»

    For the OBIEE 11g (installed on W7, DWH on MSSQL 2008R2, VM in the field), I followed the link * "http://vikramwalia.wordpress.com/category/obiee-11g/" * and stuck at the step where the browser should recover image (s) based on the following address:

    *' http://localhost:9704/analyticsRes/product / *.

    Dive into the issue, I checked the staticports.ini and in the * [WEBLOGIC] * section find the following message is displayed:

    *#The port of 'content' for the most part POET. This is the Weblogic managed server port on which BIEE applications are deploie.*
    Oracle WLS BIEE managed Server Port No. = 9704

    that seems to be OK...

    The netstat command response confuses me much since I found (and also of external) record for TCP Local address (should be < IP localhost >: 9704), which lead me to the point that, probably one of the OBIEE 11 g services not started OR I made a mistake during installation of OBIEE 11 g, although the system did not send a message about this possibility. BTW, the BI Publisher on this machine works correctly.

    So, kindly ask support or advice on this subject. Thank you
    AL

    Published by: user7374943 on 29.04.2013 01:01

    Published by: user7374943 on 29.04.2013 02:15

    Published by: user7374943 on 29.04.2013 02:19

    Not able to open the IAM blog you referred to above.

    Make sure that you have deployed the analyticsRes component as shown in http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi1113/customizing_obiee11g/customizing_obiee11g.htm. Create a folder called produced under analyticsres and start accessing images.

    Good luck...
    Isabelle Renon

  • Load a dynamic VI and keep in memory after execution

    Hi guys,.

    I use a strange setting that I have to follow a set of rules.

    My problem is the following:

    I have a main VI (which is compiled into an EXE file) that dynamically loads and executes a Subvi (the Subvi is not compiled into the EXE file). Calls Subvi has overall functional which is called only by dynamic screws, where the global is not a dependency of handmade VI and it is not compiled into the EXE file either. As you can see already, when I call my Subvi dynamic for the first time (for example it behaves like a SET function), it will define the functional global; then, when the dynamic Subvi execution stops, it releases the global functional VI. So if I call another sub - VI dynamic as a function of READING, he will not retain the information specified by SET Subvi.

    I'm not allowed to do the subVIs or global one functional dependence of handmade VI and it can not be compiled into the EXE file, so what I have to do is load the Subvi Dynamics somehow and either keep in memory even when the execution ends, or keep the functional global in memory after the first call.

    Anyone know how I would be able to do this?

    Help is appreciated,

    Drazen

    Drazen,

    When ' a VI dynamic calls functional overall for the first time, launch an another dynamic VI (Holder.vi) who has the functional overall as a Subvi.  Holder.VI does nothing except wait until the hand VI is called dynamic screws as long as Holder.vi is in memory, it will also keep the functional global in memory.

    I have not tried this, but think that it will work.  It of a little awkward, but must have a minimum size and impact on CPU resources.

    Lynn

  • VPN IPSEC ASA with counterpart with dynamic IP and certificates

    Hello!

    Someone please give me config the work of the ASA for ASA Site to Site IPSEC VPN with counterpart with dynamic IP and authentication certificates.

    He works with PSK authentication. But the connection landed at DefaultRAGroup instead of DefaultL2LGroup with certificate

    authentication.

    Should what special config I ask a DefaultRAGroup to activate the connection?

    Thank you!

    The ASA uses parts of the client cert DN to perform a tunnel-group  lookup to place the user in a group.  When "peer-id-validate req" is  defined the ASA also tries to compare the IKE ID (cert DN) with the  actual cert DN (also received in IKE negotiation), if the comparison  fails the connection fails. know you could set "peer-id-validate cert"  for the time being and the ASA will try to compare the values but allow  the connection if it cannot. 

    In general I would suggest using option "cert."

    With nocheck, we are simply not strict on IKE ID matchin the certificate, which is normally not a problem of security :-)

  • Windows Imaging Component and Cryptography Service

    I'm in big trouble with installation of WIC: I can not install it because the Setup program indicates that I have no update.inf. In addition, my cryptography service is completely shut down and if I try to restart it I get error 1079. I tried the solutions provided on this community on these two issues, but they did not work for me.

    Can someone help me please?

    PS-I use Windows 8 Enterprise

    Hi Hastelloy,

    Thank you for being a part of the Microsoft Community.

    Before you continue with the troubleshooting steps, I would like to know some information about this problem.

    1. What is the exact error code or error message that you receive?

    2. have you installed any program Intel Rapid Storage on your computer?

    3. that all the troubleshooting steps have tried to solve this problem?

    4. is this problem limited only while installing the Windows Imaging Component?

    5. What is the number of brand and model of the computer?

    6. are you connected to a domain network?

    I suggest to check the following Microsoft MSDN blog and check if it helps. This blog explains Windows Imaging Components and Windows 8.

    http://blogs.msdn.com/b/chuckw/archive/2012/11/19/Windows-imaging-component-and-Windows-8.aspx

    Please respond with more information about this problem so that we can better help you.

  • activation / deactivation of field with dynamic action and apply the attribute 'required value.

    Hello

    Wanted to know how to force the 'required' attribute for the element off after that is "activated" by a dynamic action.

    For example, consider employee form.  I would like to disable the column of employment and salary.  As soon as the user enters the name of the employee, I will 'activate' JOB and SAL columns using "dynamic action".

    IMG-1.png

    IMG-2.png

    And above works fine.  Please note that both JOBS & SAL of columns 'NULL' according to the DB table.  My question is, how to comply with the condition of 'value' Yes, after allowing them.

    Another example would be, when the user selects 'Check' or 'Project', the 'no project' column will be activated.  Otherwise, "Project No." column is disabled (that is, the value is not required).  However, when turned on, I want to apply "value required" in this column.   How to get there?   (I use APEX 4.2.6)

    Thank you

    -Anand

    Why you do not create a function that returns a Boolean, validation of the page?

    You can do something like

    BEGIN

    IF: P5_ENAME IS NOT NULL THEN

    IF: P5_JOB IS NULL THEN

    Returns false;

    ON THE OTHER

    Returns true;

    END IF;

    END IF;

    END;

    You can change it to any desired column.

  • The dynamic Types and Inventory Item Grouping

    Hello

    I'm provisioning different types of objects using dynamic Types and vCAC 6.1. In the tab "Items" vCAC, all objects of type dynamic are grouped under a kind of left, "Dynamic Types".

    For an example, I'm provisioning two dynamic types:

    -Volumes of block Vipr

    -View horizon 6 workstations

    If I set one of each of these types, they are both grouped under "Dynamic Types" in the agenda of the inventory tab. Is it possible to have all of these types under different groups? So, the volumes of vipr go "block Volumes; and work stations go under 'VDI Desktops'?

    I have attached a screenshot, and you can see that the volume 'Test vCO DT' block and the Office of vdi "Win7vCAC-v012" are both under the group "Dynamic Types" on the left. I want to separate these is easier for a user to view their items commissioned by type.

    I have custom resources defined for each of these dynamic types, but it still doesn't seem properly the group.

    Thank you

    Well, for someone who wants to know... you can do this via the DB unit.

    You need to add a new type of parent to the cat_resourcetype table, and then associate your custom and dynamic type in this same table with the parent in the parent_id field.

  • More information on BC dynamic menus and using the CSS with them

    Hi all

    The tutorial of gurus of BC on the dynamic Menus and how to style with CSS didn't make any sense for me, unfortunately. The presentation was too rushed and the screen is too small to see what was going on.

    In a previous question, I discovered how to apply CSS classes to the BC menus after a bit of a course autour.

    I put the # in front of the name of the item ID and a. in front of the class name and it was not necessary.

    I have other questions, as I am still struggling to get a dynamic menu BC style correctly with the CSS I created.

    1. If you choose CSS as the menu type, can set the font, the State of reversal and color of background of the menu items in the dynamic menu section? Or are you to this style in the CSS stylesheet?

    2. If you choose CSS as the type of menu, the option to say how the submenu is located under the main menu disappears. Then you need to define in the CSS stylesheet? And if yes in which element? UL or LI?

    3. If you choose only CSS/HTML, how is this different from the CSS option to the dynamic menu?

    4. If you choose CSS as the type of menu and if you set the width and height in the menu item, and then set a different width and height in the CSS stylesheet, the width and height wins?

    5. If you want a dynamic menu to display on an Android phone, you have to choose only the CSS/HTML and do all the style in the CSS stylesheet? Or you can avoid dynamic menus all together and just use a UL list in the model? (I'm a reagent liquid checkerboard in DW for the model).

    6. I think the dynamic menu, I have done with CSS as the type, not to show and hide items in menu void correctly on an Android phone. Is there a problem with the javascript in dynamic menus?

    Thanks for any help that you people can give on these issues!

    OK, I found out what was the real problem. I did not use the menu Module 2 V to insert the menu into the model. I made the mistake to use the label menu in the Toolbox by default.

    The menu module V2 tag is NOT in the Toolbox.

    The tag is: {module_menu, version = '2'Flash '5475' =, moduleTemplateGroup = "Default"}

    When you configure the menu items in the Menu Module in the main part of the site, select the type of menu CSS/HTML, and then just set up links and menu items. No need of style or even add classes of menu items. Although you can also do.

    The elements you style are found here: / ModuleTemplates/Menu/Default

    Problem solved 3 years later! Thank you, @Penny of the Fortune Green who explained it all. In the meantime, I've used content holders to implement lists ul for menus and their style entirely in CSS. Laughing out loud! Welll it wasn't bad, I learned a lot about CSS.

    Details of the Menu Module 2 can be found here: using the module_menu v2

  • dynamically create and addEventListener on the mouse, click

    Hi, I have 9 buttons on the main stage and each has an incremented instance P0001, P0002, P0003 name...

    I'm trying to dynamically create and addEventListener on mouse click for each call, then the function appropriate when the button is clicked, it is I who does not work, I go about it the wrong way? Thank you

    for (var i: int = 1; i < 10; i ++) {}

    var btn1:String="P000"+i.toString();

    var btn11:Object = btn1;

    var ClickBtn:String="Func"+i.toString();

    btn11.addEventListener (MouseEvent.CLICK, ClickBtn);

    i = i + 1;

    }

    function ClickBtn1(event:MouseEvent):void

    {

    trace ("in it1");

    }

    function ClickBtn2(event:MouseEvent):void

    {

    trace ("in it2");

    }

    ......

    Use:

    for (var i: int = 1; i<10; i++)="">

    This ["P000" + String (i)] .addEventListener (MouseEvent.CLICK, this ["ClickBtn" + String (i)]);

    }

  • Examination of dynamic cursor and SQL performance

    Hello world

    I'm a researcher on internet forums and oracle for what is best for my case.


    I tried to rebuild indexes. I had two methods, both works very well, but I'm looking for which is preferable from the point of view of performance

    1 - the use of cursor as in the link below.

    http://www.think-forward.com/SQL/rebuildunusable.htm


    2 - using dynamic SQL, that generated the script file, then run it.

    coil rebuildall.sql
    Select "change the index ' |" owner: '. ' || index_name |' rebuild online; '
    from dba_indexes where status = "UNUSABLE."
    spool off;

    @rebuildall.sql


    Thanks in advance. Your help is appreciated.

    In both cases, that you use dynamic SQL statements, I think that there is no difference in terms of performance, use the method you feel most comfortable

    In all cases, you can follow the timestamps (time is set on & set timing on) and connect the outputs

    Best regards
    Alfonso Vicente
    www.logos.com.uy

  • Variable session and only for a dashboard page

    Hello experts!

    I have a mission to do.

    My client wants to, in a specific dashboard page, see the current year in the guest of the year.

    So... in this page, I have a prompt of the year (the user can choose different years, 2009; 2010...)

    My client wants the guest of the year has been chosen by the current date, in our case, our default Guest, in 2011.

    My database is SQL Server and oracle directors I've created an inizialitation with this code block: SELECT (YEAR (get_date ()) <-Returns current year.) Then I created a dynamic variable and I put a default initialization with 2009.

    When I go on my dashboard page... I have two problems:

    (1) I don't see 2009 in all the pages of the dashboard. (I see only in a specific page)
    (2) I see 2009 instead of 2011 (current year)

    If I put a default initialization with 2011 I see 2011 in guests... but next year I'm having the same problem... I still see 2011...

    Any help?

    Thank you!!

    Yes, change the scope of guest to just the Page and NOT the dashboard AND create 2 separate guests for pages. I mean a curr year and one for a specific year

    Published by: Deepak Gupta on October 7, 2011 00:43

Maybe you are looking for