Created in the ListView lost when C++ ListItem custome context reference

Hi all

I have a listview that generates a list of the custome listviewItems (ie the containers). Containers have a setContextProperty to my database object. But when they are added to the list view, I can't access the database context property. I realize that the listview is not in the same context as the page but I don't understand why when I bind context for the real item the reference he lost?

Error: asset:///WorkoutListItem.qml:17: ReferenceError: can't find variable: _Dal

List.QML


Page
{
Container { ListView { id: workoutList horizontalAlignment: HorizontalAlignment.Fill

 dataModel: _Dal.ListofWorkouts listItemComponents: [ ListItemComponent {  type: "item" WorkoutListItem { workoutId: ListItemData.id workoutName: ListItemData.name } } ] }//End List }//End root
}//EndPage
 

WorkoutListItem.qml


Container { id:root property int workoutId: -1 property variant workoutName: ""

 layout: StackLayout { orientation: LayoutOrientation.LeftToRight }

 Button { id: workoutDelete text: "Delete" onClicked: { var result = _Dal.DeleteWorkout(root.workoutId) } }

 Label { id: workoutNumberLabel text: root.workoutId }

 Label { id: workoutNameLabel text: root.workoutName }

 Button { id: workoutEdit text: "Edit" onClicked: { //TODO: Open workout page } }}
 

application.cpp


QmlDocument *WorkoutListItem = QmlDocument::create("asset:///WorkoutListItem.qml").parent(this);
WorkoutListItem->setContextProperty("_Dal", dal);

Thanks in advance for any help

-J

itemRoot.ListItem.view.yourFunction(ListItemData)

yourFunction (data) is defined in the ListView itself

from there, you have access to your context

Tags: BlackBerry Developers

Similar Questions

  • Effect of color in the properties lost when used to break apart.

    Flash CS5

    How does one change graph then have the possibility to choose in the properties of color effects options such as alpha or luminosity or hue in properties?

    Integrate a file .ai library and then creating a MovieClip of it, I can change alpha of the color or brightness or hue etc. in properties through the option of color effect. Use break hand to remove a simple box of a part of the work and just applied aspects of the color disappear, back to its original appearance. Try the work but still not grouping options now. It is even if I just place the image on stage or open the graphic in the library.

    Try it out bring it a different way and to break, then alter the work group then to see if the properties has color effect option for this but still no joy.

    Try to convert graphic after editing and giving it a new name, he Faints, nothing visible even if I select this chart in the library.

    It seems that the only way to apply color effect in the properties of a chart or a MovieClip is NOT to change its content when placed on the stage. I can't do without needing to modify the program making the AI. In fact adds a box that I don't need, border of the page in this program.

    Envirographics

    Color effects can be applied to an instance of a movieClip or button or graphic symbol. When you separate an instance of movieClip, you actually spend this movieClip into its different parts, similar to the edition of the original symbol in the library. These parts, lines, and fills, no longer a movieClip, and so any changes applied to the movieClip will no longer apply.

    You can select all the individual parts after your installation of these parts and then using the Edit menu, the value of this new group of lines and fills as a movieClip and reapply the color effect.

    Alternatively, if you double-click on the movieClip on the stage, you will be in the editor. Any changes you make in the editor will be displayed in the movieClip when you return to the scene. The effect color will remain.

  • BlackBerry Smartphones remove our mail from the device or server or the two lost when option OS upgraded

    I upgraded my OS 9360 recently of OS 7.0 to v 7.1.0.336, 9.6.0.51 platform. Since the upgrade I have more the possibility to delete email messages on handheld only or on the server as well. I really enjoyed having the option to delete totally or just on my handheld and then discovered the mail later on my pc.

    When I delete a mail from my BB, now, it just removes it from my device and the leash on the server without the option to remove it so. Can you please help me get this option back?

    Kind regards
    Stefan.

    Hello and welcome to the community!

    Please see, on your BB, here:

    • Home screen > Messages > > Options > email reconciliation

    On this screen should be the ability to set the preference to "remove the ' back to 'ask '.

    Good luck!

  • Focus of the app lost when VSStudio is open in win 7

    I have a sign in application it's built in .net/Vs2010, when I run it on win 7 with firm... VSStudio app works very well that he steals the focus and works like a forground window... but as soon as I launch visual studio 2010, the leading feature no longer works thereafter. I tried even to change the registry setting to 0 for setforgroundlockedtimeout. but it works until the VS2010 is closed.

    As soon as you open VS2010... win32 api call SetForegroundWindow() fails to keep the foreground window. There after if you shut up VS2010 always not behave in the way that it supposed to be. Let this work once again, I have to restart or logout m/c then app started working as expected, but if you open studio... Update loses automatically from my application for somehwere else.

    Is plase advice the real culprit of VSStudio or something else?

    Thanks in advance.

    Niku

    Hi Niku,

    The question you have posted is related to the application of Visual Studio 2010 and it would be better suited to the MSDN Community.

    Please visit the link below to find a community that will provide the support you want.

    http://social.msdn.Microsoft.com/forums/en-us/category/VisualStudio

    Hope it will be useful.

  • find the memory leak when switching from Teststand object reference to vi

    I use Teststand to call labview vi and col ThisContext sequence to vi as object reference, but if I just completed this step and I can find the memory to help keep more, how can I avoid leaks memory inside the vi.

    See my vi, is displaying an interface message user.

    You should use a node reference close to close the references that you get after an invoke. In the code below, you should be able to close the references that you get the following:

    AsPropertyObject

    Thread

    Close these two references, once you're done with them.

    Also make sure you have turned off the collection of results of your sequence or you will use memory constantly to the results of the stage.

    Hope this helps,

    -Doug

  • call the function slot page of listItem

    -J' have a button inside a ListItemComponent (caritem) Custom and when I click on it I want to call a function of slit of the page that contains the list (carsListPage)

    CODE
    -CustomListItem contains a button that triggers the signal named itemchangePicture

    {Page}
        ID: carsListPage

    {Of container
            
    {To ListView
                ID: carsList
    dataModel: carsModel

    listItemComponents:]
    {ListItemComponent}
                    ID: listItem
    type: 'point '.
    CustomListItem {//contains a signal called itemchangePicture
                           ID: carItem
    onCreationCompleted: {}
                                
               carItem.itemchangePicture.connect (carsListPage.changePicture); This book of doewn can't can not find carsListPage
    }}}

    Slot function to change the photo to carsListPage
      function changePicture() {}
    change the image
    }
             
    } / / Page

    Thank you

    In the ListView docs, read carefully the section from "Visual list in QML", especially the parts on the ListItem.view and the surrounding things.

    Basically, you need to do what you do indirectly through a property on the ListView and access via ListItem.view, or similar approaches.

  • Can you use the color picker when setting gradients in Illustrator?

    I am able to set up a custom in Illustrator without any problem gradient, but I wanted to know if there is a way to use the color picker when setting your custom colors or if you are limited to a narrow bar of color (which has all the colors but feels harder to use for me)?

    Click color to change in the Panel degraded stop / palette. Then, double-click on the fill area at the bottom of your tool palette/Panel. Who should bring up the color picker and color you choose apply until stop in the gradient you had clicked.

    Alternatively, double-click the area fill with nothing selected to bring up the color picker. Choose your desired color, and then drag the color from the fill box to the Swatches palette/Panel to create a new shade. Later, with the gradient panel/palette active, you can drag samples directly on the steps of color to change your gradient.

  • All IT gurus out there who know Firefox... have lost the passwords saved when FF created a new profile and delete old files key3.dbf and logins.json profile.

    All IT gurus out there who know Firefox... have lost the passwords saved when FF created a new profile and delete old files key3.dbf and logins.json profile. Any ideas, anyone?

    So it's not a logins.json file?

    I see a signons3.txt file and a file signons.sqlite older, if you can try to see if you can import passwords stored in this file.

    You can force Firefox to re-import the passwords in the file signons.sqlite and regenerate the file logins.json with the following steps:

    • reset the signon.importedFromSqlite pref on the topic: config page by default via the context menu
    • Delete the logins.json file in the closed Firefox with Firefox profile folder

    When you restart Firefox, then you should have the pref signon.importedFromSqlite with the value set to true.
    You have passwords that are imported in the password manager, unless there were errors or signons.sqlite signons3.txt.

    You can open the topic: config page via the address bar.
    You can accept the warning and click on "I'll be careful" to continue.

    You can use this button to go to the current Firefox profile folder:

  • Hello. Anyone know where to find my own predefined brushes created? I've lost all but about 5 of my own creations - but even those I don't think when I look in the backups... any ideas? I am a Mac user. Thank you very much in advance for any suggestions.

    Hello. Anyone know where to find my own predefined brushes created? I've lost all but about 5 of my own creations - but even those I don't think when I look in the backups... any ideas? I am a Mac user. Thank you very much in advance for any suggestions.

    General Photoshop discussion !

    I use Windows, and we need to make visible hidden files and folders in order to see the App data access path.  OSX has a similar feature?  If you have spent the hidden files and folders things, remember what I said about the registration of CC2015 the path of the CC2014 file.  That one made me as well, but I worked it out by asking Photoshop to load new brushes and checked the place he was looking for.

    Names of preference files and locations in Photoshop CC

  • How do I set the background / highlight on the listView when select multi use

    Hi, I'm used to select multi on the list view, the problem is when the selected item does not change the background (I think by default will change in light blue)

    Maybe because I'm not using StandardListItem on itemList, I use clean container for itemList.

    How to set the color to the element highlighted on multi select listView?

    Thank you

    I use the background property on my customized itemList:

    {Of container

    ID: listItemContainer

    background: listItemContainer.ListItem.selected? Color.Create("#18AFE2"): Color.create("#018AFE2")

    ...

    }

  • I forgot my password; I have my user id; I did not create a password reset disk when I bought the computer. I need the password to install a new program

    Help - how to recover my password?  I have Windows XP on my Dell desktop computer.  I do not remember the password created when I came to the computer.  When I installed the computer, I na not create a password reset disk (didn't know I could / should) I don't remember be ased to in the instructions.  Now I need this password to install a feature required of my practice management program.

    This is a forum supported by Microsoft, the best advice that we are allowed to give you here is in the following article.  Despite its title, it contains a few constructive suggestions:

    "Microsoft's strategy concerning lost or forgotten passwords"
      <>http://support.Microsoft.com/kb/189126 >

    If this does not help, I strongly suggest Googling elsewhere.

    HTH,
    JW

  • audio is lost when the video is imported in windows live movie maker but works when it is open in windows media player.

    audio of my video is lost when I import into windows live movie maker, but can be heard when played in media player. video is from jvc camcorder handy, file type is: MOD (video clip)

    Just because a file is played in Windows Media Player
    does not ensure that it will be compatible with the film

    Maker. Might be worth trying to convert MOD files
    before you import into Movie Maker WMV format.

    Perhaps the following links will propose a few ideas:

    Use. MOD with Windows Movie Maker files
    http://www.YouTube.com/watch?v=m31Ji4U5jWI&feature=related

    How to edit JVC. MOD files in a few easy steps
    http://www.YouTube.com/watch?v=ZY-cKaCEUJ4

    How to convert AVI files to Movie Maker MOD files
    http://www.ehow.com/how_5854160_convert-AVI-files-Movie-Maker.html

    There are many programs that can do conversions...
    The following freeware is an example...:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Format Factory
    http://www.videohelp.com/tools/Format_Factory
    (the 'direct link' is faster)
    (the file you want to download is: > FFSetup260.zip<>
    (FWIW... installation..., you can uncheck
    ('all' boxes on the last screen)

    First, you will need to decompress the file or just open the
    Drag FFSetup260.exe out of the folder
    and drop it on your desktop. To install left click.

    Next, after the download and installation of Format
    Factory... you can open the program and
    left click on the toolbar, the "Option" button and
    "Select an output folder to" / apply / OK.
    (this is where you find your files after they)
    are converted)

    Drag and drop your video clips on the main screen...

    Select "all to WMV" / OK...

    Click on... Beginning... in the toolbar...

    That should do it...

    Good luck...

  • To access the values from the row outside the ListView ListItem

    Hello

    I spent two hours browsing the forums and documentation with no chance of finding a solution on how to access the list item data from outside the listview.

    Let explain me my code. It is marked with I work and what does not work and its expected behavior.

    Should work behavior


    Tapping & getting data

    The arrayDataModel is filled with 4 rows. Firstly the list item, second item in the list... etc.

    • Tapping on the order of the day, label with the id of triggeredText displays the value of a threaded list item.
    • The index of the tapped icon appears in the label with the id of triggerredIndex.

    Incrementing Index using ActionItems onBar

    By pressing action items 'previous' and 'next', you can increment the index value to the label with the id of triggeredIndex. The order of the index is 0-4, even as total of the items in the list.

    How to extract data from the index when the value of triggeredIndex?

    Buttons

    The buttons at the bottom of the screen... Select 1, select the 2nd, 3rd Select should select indexes 0,1,2 of the list and display the value in triggeredText and triggeredIndex. They do not work.

    How did I pull the values when you click the buttons?

    import bb.cascades 1.3
    
    TabbedPane {
        id: root
        showTabsOnActionBar: false
    
        Tab {
            id: mainTab
            title: "Test List"
                Page {
                    id: mainPage
                    titleBar: TitleBar {
                        title: "List Traversal Test"
                    }
                    actions: [
                        ActionItem {
                            title: "Previous"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // get current selected index from list=
                                var currentIndex = parseInt(triggeredIndex.text);
    
                                if(currentIndex <= 0){
                                    //do nothing already at first item
                                }else{
                                    // subtract 1 from index ( ci - 1) ?
                                    var newIndex = parseInt(triggeredIndex.text) - 1;
    
                                    // show data from new selected index
                                    // ???
    
                                    // triggeredItem.text = XXX // the data
                                    // ???
    
                                    // triggeredIndex.text = X // the current index
                                    triggeredIndex.text = newIndex;
                                }
                            }
                        },
                        ActionItem {
                            title: "Next"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // get current selected index from list=
                                var currentIndex = parseInt(triggeredIndex.text);
    
                                if(currentIndex == 4){
                                    //do nothing already at lastitem
                                }else{
                                // add 1 to index ( ci + 1) ?
                                var newIndex = parseInt(triggeredIndex.text) + 1
    
                                // show data from new selected index
                                // ???
    
                                // triggeredItem.text = XXX // the data
                                // ???
    
                                // triggeredIndex.text = X // the current index
                                triggeredIndex.text = newIndex;
                            }
                            }
                        },
                        ActionItem {
                            title: "Clear"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // set current index to 0 (top item in list)
                            }
                        }
    
                    ]
                    Container {
                        preferredHeight: maxHeight
                        layout: StackLayout {
                            orientation: LayoutOrientation.TopToBottom
                        }
    
                        Label{
                            id: triggeredItem      // value of listitem from current index
                            text: "0"
                        }
                        Label{
                            id: triggeredIndex    // current index
                            text: "0"
                            onTextChanged: {
                                // set triggeredItem.text to contents of selected ListItem with same index
                                // STUCK HERE cannot access ListItem.dataModel(indexPath) from here....
                            }
    
                        }
                        Container{
                            ListView {
    
                                id: theList
                                objectName: "dalist"
                                dataModel: ArrayDataModel {
                                    id: theListModel
                                }
                                listItemComponents: ListItemComponent {
                                    StandardListItem {
                                        id: itemRoot
                                        title: ListItemData
                                    }
    
                                }
                                onTriggered: {
                                    var si = dataModel.data(indexPath);
                                    triggeredItem.text = "LIST ITEM CONTENT: " + si;  //set content when user taps on item
                                    triggeredIndex.text = "LIST ITEM INDEX INDEX: " + indexPath;  // set index when user taps
                                }
    
                                onSelectionChanged: {
                                    //console.log(selected);
                                }
    
                                onCreationCompleted: {
    
                                    //add some data to the listview
                                    theListModel.append("First List Item");
                                    theListModel.append("Second List Item");
                                    theListModel.append("Third List Item");
                                    theListModel.append("Fourth List Item");
                                }
                            }
    
                        }
                        Container{
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                        Button{
                            text: "Select 1st"
                            onClicked: {
                                theList.clearSelection();
                                theList.select(0);
    
                            }
                        }
                        Button{
                            text: "Select 2nd"
                            onClicked: {
                                theList.clearSelection();
                                theList.select(1);
    
                            }
                        }
    
                        Button{
                            text: "Select 3rd item"
                            onClicked: {
    
                                //expected behaviour is to show data from Third List Item
    
                                // triggeredIndex.text = INDEX 3
                                // triggeredText.text = (DATA FROM THIRD LIST ITEM)
    
                                // THIS IS NOT WORKING ....
                                theList.clearSelection();
                                theList.select(2);
                                console.log(theList.dataModel(3));
                                triggeredItem.text = theListModel.dataModel(3);
    
                            }
                        }
                    }
                   }
                }
            }//tab
    }
    

    Thank you and have a happy and healthy 2015!

    Your help will be greatly appreciated.

    I ran and got this:

    asset:///main.qml:161: TypeError: Result of expression 'theList.dataModel' [bb::cascades::ArrayDataModel(0x1091a838)] is not a function.
    

    But it works

    theListModel.data([3])
    

    But this isn't the solution, you have a more serious problem. You select a value, you trigger. If you add this in onTriggered you select it (and you can see that it changes color when it is selected).

    theList.select(indexPath);
    

    If you want to use option to deselect

    theList.select(indexPath, !theList.isSelected(indexPath));
    

    And if you want to have that one chose this

    theList.clearSelection();
    theList.select(indexPath);
    

    Inside the button 'Select the 3rd point' allows to select programmatically

    theList.select([2]);
    

    It works but I'm not sure what you're trying to do

  • What signal is emitted in the ListView, when one of its cells appears in or from the screen turns off?

    What signal is emitted in the ListView, when one of its cells appears in or from the screen turns off?

    I created listView with custom listItemComponents

    Is there any signal when listItemComponent go to the screen?

    Currently, it is not possible to detect if the cells turns off the screen. Even if you join LayoutUpdateHandler them they will just stop send updates when you go off the screen. I managed to hack a solution using a timer, but I guess that a cleaner approach would more use a ScrollView with CustomControls instead:

    1. get the dimensions of the ScrollView joining ScrollView LayoutUpdateHandler.

    2. attach the LayoutUpdateHandlers to the CustomControls.

    UPD: It is also viewableArea & viewableAreaChanged event scrollView property.

    3. If the controls that were inside the visible area of the ScrollView went outside, raises the event.

    Of course re-use of cell works that way.

    It's so easy to grab the cell on the screen:

    If you use ListItemProvider, updateItem() function is called when the element appears on the screen:

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__listitemprovider.html

    It will also be called if the data item are updated in the model.

    When the item is created for the first time, createItem() is called.

  • Cannot create aliases form container in the listview

    I tabpane wich call page of the listview. If a tab is trigerred the container property will change (as the background) based on the value I initialize in tab pane with alias:

    But I can't create aliases to change the ListView:

    Like this:

    Page{
     id: page
     property alias color: containerColor.background
    
      Container{
        Listview{
          listItemComponents: [
            ListItemComponent {
                type: "item"
                Container {
                  id: containerColor
    
                  //other code
                }
            }
          ]
        }
      }
    
    }
    

    What should I do?

    Thank you.

    Unlike ListItemData, ListItem is defined only for top-level ListItemComponent element. I think it should work:

    ListItemComponent {
      type: "listItem"
      Container {    id: topContainer // <----------- added line
    

    ...

    background: topContainer.ListItem.view.getBackgroundColor()
    

Maybe you are looking for