ListView - problem DockLayout

Here is my code

import bb.cascades 1.2
Page {
    Container {
           layout: DockLayout {}

                Container {
                    verticalAlignment: VerticalAlignment.Top
                    horizontalAlignment: HorizontalAlignment.Fill
                    Button {
                        text: "1.button"
                        horizontalAlignment: HorizontalAlignment.Fill

                    }
                }

                Container {
                    verticalAlignment: VerticalAlignment.Center

                    ListView {

                        dataModel: XmlDataModel {
                            source: "asset:///currencies.xml"
                        }
                    }

                }

                Container {
                    verticalAlignment: VerticalAlignment.Bottom
                    horizontalAlignment: HorizontalAlignment.Fill

                  Button {
                      text: "2. button"
                      horizontalAlignment: HorizontalAlignment.Fill

                  }
                }

    }
}

When I use a viev list in a layout of the dock it dosent fit properly.instead, it collides with the first container.

should he not just after the first container since I updated the verticallayout Center for container parent of the listview.

Thanks in advance.

When using the dock layout object are added as layers and the order given in qml are important. Your code adds a listview on top of the first box. What is happening, is that you will not be able to capture the actions for this button and once filled, the listview will overlap graphically the key 1.

Below is an approach valid at your intent:

import bb.cascades 1.2

Page {
    Container {
        layout: DockLayout {
        }

        Container {
            id: cont
            bottomPadding: 73
            verticalAlignment: VerticalAlignment.Top
            horizontalAlignment: HorizontalAlignment.Fill
            Button {
                bottomMargin: 0
                text: "1.button"
                horizontalAlignment: HorizontalAlignment.Fill
                onClicked: {
                    console.log("dsds");
                }
            }
            Container {
                //background: Color.Blue
                ListView {
                    dataModel: XmlDataModel {
                        source: "asset:///currencies.xml"
                    }
                }
            }
        }

        Container {
            verticalAlignment: VerticalAlignment.Bottom
            horizontalAlignment: HorizontalAlignment.Fill

            Button {
                text: "2. button"
                horizontalAlignment: HorizontalAlignment.Fill
                onClicked: {
                    console.log("da asdsa");
                }
            }
        }
    }
}

Tags: BlackBerry Developers

Similar Questions

  • BB10: ListView problem background elements

    Hi guys,.

    I have a listview which elements have origins are different colors (see figure). Each element background color depends on a specific element of the element in the data model (say ListItemData.color).

    But for some reaason, when I scroll to the bottom of the list and scroll to the top, the background changes color. I do not understand this weird behavior.

    People you have an idea about what is happening on or at least how to solve?

    Thank you!

    Hi all

    I solve it by doing this:

    Label
    {
        visible: false
        text: ListItemData.id
    
        onTextChange:
        {
            root.background = ListItemData.color;
        }
    }
    

    It's not elegant at all, but at least it works. The 'id' the ListItem is the only single member. So evertytime this invisible label text changes with the new id, it resets the background for that particular item.

    It is a pity I have to use such a solution for this problem.

    Thank you all!

  • ListView problem: scrolling non-stop

    Hello friends,

    I get some problem with ListView in ScrollView ListView doesn't stop scrolling.

    I want to put some of the views (for example, Label, textArea Image) in the vertical stack layout container & add a list at the end of the container, so that all opinions can scrolls.

    But I get unexpected results that everything is ok, but my view of the list doesn't stop event of scrolls of the item in the scrolling list.

    If I add some other view as tab after ListView then it never reached.

    Can someone give me a solution for this.

    Thanks in advance

    I use the following code for QML

    import bb.cascades 1.0

    {Of container

    background: Color.Yellow
    maxHeight: 1000
    preferredHeight: 1000
    ScrollView {}
    maxHeight: 1000
    preferredHeight: 1000
    {Of container
    {Of container
    topPadding: 10
    leftPadding: 10
    rightPadding: 10

    {Of container
    layout: {StackLayout}
    direction: LayoutOrientation.LeftToRight
    }
    TextField {}
    hintText: qsTr ("toEmail/Mobile number Email/Mobile Number") "") "
    }
    ImageButton {}
    defaultImageSource: ' images/add.png.
    pressedImageSource: ' images/add_focus.png.
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: P
    }
    }
    {Of container
    topMargin: 10
    layout: {StackLayout}
    direction: LayoutOrientation.LeftToRight
    }
    ImageView {}
    preferredWidth: 120
    preferredHeight: 90
    }
    TextArea {}
    maximumLength: 50
    hintText: "title."
    preferredHeight: 180
    }
    }
    background: Color.LightGray
    preferredHeight: 720
    }

    {To ListView
    dataModel: {ArrayDataModel}
    ID: contacts
    }
    }

    onCreationCompleted: {}
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    contacts. Append ("ABAC");
    }
    }
    }
    }

    As far as I know, using listview in scrollview will cause infinite scrolling. To resolve this issue, try to set the height of the listview. You can also try to set the height of the listview based on the number of records by using contacts.size ();

    It will be useful.

  • To reorder ListView problem

    Hello

    10.3, reorganize the listview items is now possible via the RearrangeHandler class (https://developer.blackberry.com/native/reference/cascades/bb__cascades__rearrangehandler.html)

    I noticed during the implementation of this class that rearranging works only when the elements below are trained upward. When the elements at the top of the page it is slipped down the list, none of the signals (started, completed, updated, abandoned) don't are not fired. The user interface changes automatically isn't.

    Both the sample application or my implementation does not work when the elements above are trained more far.

    Can a BlackBerry person take a look at this? Thanks in advance.

    I tested on the official bone on the passport and classic version.

    I tried this sample and I see the same behavior that you are.  I sent the question to our development team to resolve.

    10.3.1 signals are fired, but you can not yet move items down.

  • Display of images in a ListView problem

    Hello world

    I'm trying to display images in a grid (GridListLayout) in a ListView component (as in This example). However, it just displays the paths to the images I try to view (if it is not clear for you take a look at attachment 1). What I am doing wrong?

    In my data model, you can find this method of data:

    QVariant ComicsDataModel::data(const QVariantList& indexPath)
    {
        return QVariant("assets/images/legodude.jpg");
    //return coverList.at(indexPath[0].toInt());
    }
    

    The commented code returns the actual filepaths (absolute paths), but who doesn't either. Of course, I have included the image in the assets/images folder. The ListView is specified as written below.

                ListView {
                    objectName: "coverListView"
                    layout: GridListLayout {}
    
                    listItemComponents: [
                        ListItemComponent {
                            type: "image"
    
                            ImageView {
                                imageSource: ListItemData
                                scalingMethod: ScalingMethod.AspectFill
                            }
                        }
                    ]
                }
    

    Thanks for the help! All of the examples to work with images using XML as datamodel, I use a custom data model.

    Annex 1:

    Probably your datamodel custom does figure not correctly return the correct values in the DataModel::itemType() function - make sure you return 'image' properly in your overload of itemType() - or use the equivalent ListView callback function in QML

  • Parsing JSON to ListView array problem

    I need help in parsing JSON to ListView array.

    I have no problem to parse this JSON

    [
        {
            "id": "123",
            "name": "KFC",
            "contact": {
                "phone": "+1175757",
                "twitter": "kfc"
            }
        }
    

    to this qml:

    import bb.cascades 1.0
    import bb.data 1.0
    Page {
        content: ListView {
            id: listView
            dataModel: dataModel
            listItemComponents: [
                ListItemComponent {
                    type: "item"
                    Container {
                        verticalAlignment: VerticalAlignment.Center
                        Container {
                            horizontalAlignment: HorizontalAlignment.Fill
                            verticalAlignment: VerticalAlignment.Center
                            layout: DockLayout {
    
                            }
                            Container {
                                horizontalAlignment: HorizontalAlignment.Fill
                                verticalAlignment: VerticalAlignment.Center
                                topPadding: 20
                                layout: StackLayout {
                                    orientation: LayoutOrientation.LeftToRight
                                }
                                Container {
                                    verticalAlignment: VerticalAlignment.Center
                                    leftMargin: 30
                                    Label {
                                        bottomMargin: 0
                                        bottomPadding: 0
                                        text: ListItemData.name
                                        verticalAlignment: VerticalAlignment.Center
                                        textStyle {
                                            base: SystemDefaults.TextStyles.TitleText
                                            fontWeight: FontWeight.Normal
                                        }
                                    }
                                }
                            }
                        }
                        Divider {
                        }
                    }
                }
            ]
        }
        attachedObjects: [
            GroupDataModel {
                id: dataModel
            },
            DataSource {
                id: dataSource
                source: "myjson.json"
                onDataLoaded: {
                    dataModel.insertList(data)
                }
            }
        ]
        onCreationCompleted: {
            dataSource.load();
        }
    }
    

    but I do not know how to work with this type of JSON:

    {
        "meta": {
            "code": 200
        },
        "response": {
            "myplace": [
                {
                    "id": "123",
                    "name": "KFC",
                    "contact": {
                        "phone": "+1657465",
                        "twitter": "kfc"
                    }
                }
            ]
        }
    }
    

    can someone help please!

    The problem is that DataSource will convert your JSON to a QVariantMap, and not to a QVariantList, as required by the GroupDataModel::insertList ().  Try this:

            DataSource {
                id: dataSource
                source: "myjson.json"
                onDataLoaded: {
                    dataModel.insertList(data.response.myplace)
                }
            }
    
  • indicator problem ListView and activity

    Hi, I was playing around with the sample application address book so that I have included a button to re-populate the list view. It takes a few seconds, that's why I've included an indicator of activity runs while the list view is being filled.

    The activity indicator is supposed to start when the button is pressed and stop when the display of the list has been entered.

    Now, my problem is that the activity indicator seems to start when the display of the list has been populated (it just starts and stops in a Flash). I have also included a header which changes the onbuttonclicked text to check if that was the problem-indicator of activity but same thing happening (text only changes after listview is filled). The list view appears to stop all operations until it was settled.

    What is the cause and how can I solve this problem? Thank you.

    onButtonClicked {}
    change the header text
    start the activity indicator
    fill listview
    }

    Then in c ++ after m_model-> insert (map) I emit a stop to the activity indicator signal.

    Indicator text and header activity does not change until the listview has been briefed.

    as the list of all the opinions of the population occurs on the event thread indicator gets no time to do things.
    If you would like to fill in the asynchronous list, it should work as expected.

    as a sidenote: have a look to refresh the headers, they are often used to reload a list.

  • ListView context menu function problem

    I'm trying to get positions in my context menu and the button to work, but the file for routing functions doesn't seem to work

    ListView {
                        function getApp() { // 1
                            return _app
                        }
    
                        id: listView
                        property string selectedItemID
                        dataModel: _app.dataModel
    
                        listItemComponents: [ // 2
    
                            ListItemComponent {
                                type: "item"
                                Container {
                                    id: itemContainer
                                    layout: StackLayout {
                                        orientation: LayoutOrientation.LeftToRight
                                    }
                                    StandardListItem {
                                        id: rootItem // 3
                                        title: ListItemData.name
                                        description: ListItemData.description
    
                                        contextActions: [
                                                      ActionItem {
    
                                                        title: qsTr("Clear All") + Retranslate.onLanguageChanged
                                                        imageSource: "asset:///images/ic_clear_list.png"
                                                        attachedObjects: [
                                                            SystemToast {
                                                                id: clearToast
                                                                body: qsTr("All Items Deleted") + Retranslate.onLanguageChanged
                                                            },
                                                            SystemDialog {
                                                                id: clearDialog
                                                                title: qsTr("Clear List") + Retranslate.onLanguageChanged
                                                                body: qsTr("This action will delete all list items.  This action cannot be un-done.") + Retranslate.onLanguageChanged
                                                                onFinished: {
                                                                    if (clearDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        rootItem.ListItem.view.getApp().clearObjects() // 4
    
                                                                    if (clearDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        clearToast.show()
    
                                                                }
                                                            }
                                                        ]
                                                        onTriggered: {
                                                            clearDialog.show()
                                                        }
                                                    },
                                                    DeleteActionItem {
                                                        title: qsTr("Delete") + Retranslate.onLanguageChanged
                                                        imageSource: "asset:///images/delete.png"
                                                        attachedObjects: [
                                                            SystemToast {
                                                                id: deleteToast
                                                                body: qsTr("Item Deleted") + Retranslate.onLanguageChanged
                                                            },
                                                            SystemDialog {
                                                                id: deleteDialog
                                                                title: qsTr("Delete Item") + Retranslate.onLanguageChanged
                                                                body: qsTr("This action will delete this item.  This action cannot be un-done.") + Retranslate.onLanguageChanged
                                                                onFinished: {
                                                                    if (deleteDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        rootItem.ListItem.view.getApp().deleteObject(ListItemData.customerID) // 4
    
                                                                    if (deleteDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        deleteToast.show()
    
                                                                }
                                                            }
                                                        ]
                                                        onTriggered: {
                                                            deleteDialog.show()
    
                                                        }
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                    Label {
                                        text: ListItemData.lat
                                        textStyle.fontSize: FontSize.Large
                                    verticalAlignment: VerticalAlignment.Center
    
                                }
                                    Button {
                                        leftPadding: 30
                                        rightPadding: 30
                                        preferredWidth: 150
                                        imageSource: "asset:///images/ic_add.png"
                                        onClicked: {
                                            rootItem.ListItem.getApp().updateObject(ListItemData.customerID, ListItemData.name, ListItemData.description, ListItemData.datefield, ListItemData.lat + 1, ListItemData.lon, ListItemData.categorySelect, ListItemData.mapurl)
                                        }
                                    }
                                }
    
                            }
    
                        ]
                        onTriggered: {
                            clearSelection()
                            select(indexPath)
    
                        }
    

    Any help would be greatly appreciated.

    Okay, I should have added more information.  I managed to find a workaround.  instead of using a standard list item, I just made each item container.

    Here is the new labour code:

    ListView {
                        function getApp() { // 1
                            return _app
                        }
    
                        id: listView
                        property string selectedItemID
                        dataModel: _app.dataModel
    
                        listItemComponents: [ // 2
    
                            ListItemComponent {
                                type: "item"
                                Container {
                                    id: rootItem
                                    rightPadding: 20
                                    leftPadding: 20
                                    contextActions: [
                                            ActionSet {
                                                title: ListItemData.name
                                                actions: [
                                                    ActionItem {
                                                        title: qsTr("Edit") + Retranslate.onLanguageChanged
                                                        imageSource: "asset:///images/ic_edit.png"
                                                        attachedObjects: [
                                                            Sheet {
                                                                id: editSheet
    
                                                                Page {
    
                                                                    id: rootPage
                                                                    titleBar: TitleBar {
                                                                        id: editBar
                                                                        title: qsTr("Edit") + Retranslate.onLanguageChanged
                                                                        visibility: ChromeVisibility.Visible
    
                                                                        dismissAction: ActionItem {
                                                                            title: qsTr("Cancel") + Retranslate.onLanguageChanged
                                                                            onTriggered: {
                                                                                // Hide the Sheet.
                                                                                editSheet.close()
                                                                            }
                                                                        }
                                                                        acceptAction: ActionItem {
                                                                            title: qsTr("Save") + Retranslate.onLanguageChanged
                                                                            onTriggered: {
                                                                                // Hide the Sheet and emit signal that the item should be saved
                                                                                rootItem.ListItem.view.getApp().updateObject(ListItemData.customerID, name2.text, ListItemData.description, datefield2.text, counter.text, limittwo.text, ListItemData.categorySelect, ListItemData.mapurl);
                                                                                editSheet.close()
                                                                                editToast.show()
                                                                                name2.text = ""
                                                                                counter.text = ""
                                                                                limittwo.text = ""
                                                                            }
                                                                        }
                                                                    }
    
                                                                    Container {
    
                                                                        layout: DockLayout {
                                                                        }
                                                                        //! [0]
                                                                        Container {
                                                                            horizontalAlignment: HorizontalAlignment.Center
    
                                                                            topPadding: 30
                                                                            leftPadding: 30
                                                                            rightPadding: 30
                                                                            Container {
                                                                                topPadding: 30.0
                                                                                layout: StackLayout {
                                                                                    orientation: LayoutOrientation.LeftToRight
                                                                                }
    
                                                                                TextField {
                                                                                    id: name2
                                                                                    text: ListItemData.name
                                                                                    horizontalAlignment: HorizontalAlignment.Center
    
                                                                                }
                                                                                Label {
                                                                                    id: datefield2
                                                                                    text: {
                                                                                        var today = new Date();
                                                                                        (today.getMonth() + 1) + "/" + today.getDate() + "/" + (today.getFullYear() - 2000);
                                                                                    }
                                                                                }
    
                                                                            }
                                                                            Container {
                                                                                layout: StackLayout {
                                                                                    orientation: LayoutOrientation.LeftToRight
                                                                                }
                                                                                topPadding: 40
    
                                                                                TextField {
    
                                                                                    id: counter
                                                                                    text: ListItemData.lat
    
                                                                                    inputMode: TextFieldInputMode.NumbersAndPunctuation
    
                                                                                }
                                                                            TextField {
    
                                                                                id: limittwo
                                                                                text: ListItemData.lon
                                                                                hintText: qsTr("Limit") + Retranslate.onLanguageChanged
                                                                                inputMode: TextFieldInputMode.NumbersAndPunctuation
    
                                                                            }
    
                                                                        }
    
                                                                            attachedObjects: [
                                                                                SystemToast {
                                                                                    id: editToast
                                                                                    body: qsTr("Item Edited") + Retranslate.onLanguageChanged
                                                                                }
                                                                            ]
                                                                        }
                                                                        //! [0]
                                                                    }
                                                                }
                                                            }
    
                                                        ]
                                                        onTriggered: {
                                                            editSheet.open()
                                                        }
                                                    },
                                                    ActionItem {
                                                      title: qsTr("Reset") + Retranslate.onLanguageChanged
                                                      imageSource: "asset:///images/update.png"
                                                      attachedObjects: [
                                                          SystemToast {
                                                              id: restToast
                                                              body: qsTr("Item Count Reset") + Retranslate.onLanguageChanged
                                                          },
                                                          SystemDialog {
                                                              id: resetDialog
                                                              title: qsTr("Reset") + Retranslate.onLanguageChanged
                                                              body: qsTr("This action will reset the item count to one.  You can edit the count afterwards in the edit sheet if you wish.") + Retranslate.onLanguageChanged
                                                              onFinished: {
                                                                  if (resetDialog.result ==
                                                                  SystemUiResult.ConfirmButtonSelection)
                                                                      rootItem.ListItem.view.getApp().updateObject(ListItemData.customerID, ListItemData.name, ListItemData.description, Date(), 1, ListItemData.lon, ListItemData.categorySelect, ListItemData.mapurl)
    
                                                                  if (resetDialog.result ==
                                                                  SystemUiResult.ConfirmButtonSelection)
                                                                      resetToast.show()
    
                                                              }
                                                          }
                                                      ]
                                                      onTriggered: {
                                                          resetDialog.show()
                                                      }
                                                    },
                                                    InvokeActionItem {
                                                        title: qsTr("Share") + Retranslate.onLanguageChanged
                                                        query {
                                                            mimeType: "text/plain"
                                                            invokeActionId: "bb.action.SHARE"
                                                        }
                                                        onTriggered: {
                                                            data = ListItemData.name + " count: " + ListItemData.lat + ". Shared using the TiCat app!";
                                                        }
                                                    },
    
                                                    ActionItem {
    
                                                        title: qsTr("Clear All") + Retranslate.onLanguageChanged
                                                        imageSource: "asset:///images/ic_clear_list.png"
                                                        attachedObjects: [
                                                            SystemToast {
                                                                id: clearToast
                                                                body: qsTr("All Items Deleted") + Retranslate.onLanguageChanged
                                                            },
                                                            SystemDialog {
                                                                id: clearDialog
                                                                title: qsTr("Clear List") + Retranslate.onLanguageChanged
                                                                body: qsTr("This action will delete all list items.  This action cannot be un-done.") + Retranslate.onLanguageChanged
                                                                onFinished: {
                                                                    if (clearDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        rootItem.ListItem.view.getApp().clearObjects() // 4
    
                                                                    if (clearDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        clearToast.show()
    
                                                                }
                                                            }
                                                        ]
                                                        onTriggered: {
                                                            clearDialog.show()
                                                        }
                                                    },
                                                    DeleteActionItem {
                                                        title: qsTr("Delete") + Retranslate.onLanguageChanged
                                                        imageSource: "asset:///images/delete.png"
                                                        attachedObjects: [
                                                            SystemToast {
                                                                id: deleteToast
                                                                body: qsTr("Item Deleted") + Retranslate.onLanguageChanged
                                                            },
                                                            SystemDialog {
                                                                id: deleteDialog
                                                                title: qsTr("Delete Item") + Retranslate.onLanguageChanged
                                                                body: qsTr("This action will delete this item.  This action cannot be un-done.") + Retranslate.onLanguageChanged
                                                                onFinished: {
                                                                    if (deleteDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        rootItem.ListItem.view.getApp().deleteObject(ListItemData.customerID) // 4
    
                                                                    if (deleteDialog.result ==
                                                                    SystemUiResult.ConfirmButtonSelection)
                                                                        deleteToast.show()
    
                                                                }
                                                            }
                                                        ]
                                                        onTriggered: {
                                                            deleteDialog.show()
    
                                                        }
                                                    }
                                                ]
                                            }
                                        ]
                                    Container {
                                        id: rootItemtwo
                                        layout: StackLayout {
                                            orientation: LayoutOrientation.TopToBottom
                                        }
    
                                    Container {
                                        id: rootItemthree
                                        layout: StackLayout {
                                            orientation: LayoutOrientation.LeftToRight
                                        }
    
                                    Label {
    
                                        preferredWidth: 450
                                        text: ListItemData.name
                                        textStyle.fontSize: FontSize.Large
                                    }
                                    Label {
    
                                        minWidth: 100.0
                                        preferredWidth: 100.0
                                        maxWidth: 120
                                        text: ListItemData.lat
                                        textStyle.fontSize: FontSize.Large
                                    verticalAlignment: VerticalAlignment.Center
    
                                }
                                    Label {
                                        translationY: 5
                                        text: "/" + ListItemData.lon
                                        textStyle.fontSize: FontSize.Small
                                        verticalAlignment: VerticalAlignment.Center
    
                                        textStyle.color: Color.DarkGray
                                            minWidth: 100.0
                                            preferredWidth: 100.0
                                        }
                                    Button {
                                        leftPadding: 30
                                        rightPadding: 30
                                        preferredWidth: 150
                                        horizontalAlignment: HorizontalAlignment.Center
                                        imageSource: "asset:///images/ic_add.png"
                                        onClicked: {
    
                                            rootItem.ListItem.view.getApp().updateObject(ListItemData.customerID, ListItemData.name, ListItemData.description, ListItemData.datefield, parseInt(ListItemData.lat) + 1, ListItemData.lon, ListItemData.categorySelect, ListItemData.mapurl)
                                        }
                                    }
                                    }
    
                                    Label {
                                        translationY: -20
                                        minWidth: 600
                                        preferredWidth: 600
                                        text: "Last Count: " + ListItemData.datefield
                                        textStyle.fontSize: FontSize.XSmall
                                        textStyle.color: Color.DarkGray
                                        horizontalAlignment: HorizontalAlignment.Left
                                    }
    
                                    Divider {
                                        translationY: -20
                                    }
                                }
                                    bottomPadding: 5
    
                                }
    
                            }
    
                        ]
                        onTriggered: {
                            clearSelection()
                            select(indexPath)
                        }
                    }
                }
    
  • Problem after a long press on a ListView, contextActions ActionItem loses the selection

    Trying to implement a long press on a ListView to make appear a contextActions ActionSet.

    The problem comes when the ActionItem came out the selection of ListView is cleared I don't give no pleasant way to read the row my C++ code.

    Yes, I can do a code messy to save the item enabled in a ListView of the QML breast property when 'onActivationChanged' is called and read later than my C++ code but I prefer to do it cleanly.

    Lack of documentation and examples of slow development once more.

    Or what is more likely is that this behavior has simply not thought at the time.

    For those thinking just use "onTriggered" and put in place a button instead, this action is used for something else.

    So this expected behavior?

    ContextMenus (ActionItems) are not compatible with the ListView?

    Did someone come up with a way to clean way to do this?

    Hi BBSJdev,

    You can see the example of Battambang, available under https://github.com/blackberry/Cascades-Samples/tree/master/bucketlist

    There LongPress, ConextMenu, simple and select Multi, it may have what you are looking for.

    I hope this helps.

  • Problem with the space above the ListView

    Hello

    My app contains some dialog boxes and pages created in qml containing some listviews. My problem is that all of these lists do not start at the top of my page dialog box. There is a black before the listview space even if I tried using DispositionAbsolue and affecting at 0,0 and we tried the topMargin and topPadding setting to 0. No container has a background of #000000 in my qml file.

    I don't have this problem if I do not use a ListView in a dialog so to do with ListView.

    Can someone tell me what is happening and how to fix it please?

    Tim

    you could try a negative margin on the outside container

  • ListView selected item problem in a sheet.

    Hello

    In my main.qml, I have a listview using the standardlistitem.

    I have a popup menu attached to the standardlistitems.

    Now, initially, I had a problem of selection of a list item when I called one of the options in the context menu of the element. The element does not get selected when you make the menu appear.

    To solve this, I use the onTriggered signal from the context menu to call select on the listview. He calls the onSelectionChanged listView itself signal.

    Now here is my problem:

    If I call a function c ++ this signal of the main.qml and in this c function onSelectionChanged ++ I call the funtion selected() on ListView to obtain the row function works correctly and the index is returned.

    But if I have everything first to make a visible sheet and call the function c ++ within the call to selected() worksheet returns nothing.

    There is nothing in my qml or CPP which clears the selection, this occurs by default or something when the worksheet is opened?

    THX.

    * beep * bad forum, I have no idea why I did it!

    IM opening a new post in the forum of cascades and put to resolved.

  • ListView / sheet problem - not selected item after the opening of leaf.

    Hello

    In my main.qml, I have a listview using the standardlistitem.

    I have a popup menu attached to the standardlistitems.

    Now, initially, I had a problem of selection of a list item when I called one of the options in the context menu of the element. The element does not get selected when you make the menu appear.

    To solve this, I use the onTriggered signal from the context menu to call select on the listview. He calls the onSelectionChanged listView itself signal.

    Now here is my problem:

    If I call a function c ++ this signal of the main.qml and in this c function onSelectionChanged ++ I call the funtion selected() on ListView to obtain the row function works correctly and the index is returned.

    But if I have everything first to make a visible sheet and call the function c ++ within the call to selected() worksheet returns nothing.

    There is nothing in my qml or CPP which clears the selection, this occurs by default or something when the worksheet is opened?

    THX.

    This answer worked for you?

    Graham

  • Problem with ListView

    Hello

    When I select a line from my ListView, my ListView is moved to the top!

    For more information, it's my CSS file:

    {.customListView}

    -fx-font-size: 12.0pt;

    -fx-font-weight: normal;

    }

    .list-cell: filled: selected: concentrate, .list-cell: filled: selected {}

    -fx-background-color: #BCD4E5;

    -fx-background-inserts: 0.0, 0.0 0.0 0.0 0.0;

    -fx-text-fill:-fx-selection-bar-text;

    -fx-table-cell-border-color: #E0F2FF;

    }

    .list-{cell: odd}

    -fx-cell-hover-color: #0093ff;

    -fx-background-color: white;

    }

    .list-cell: filled: hover {}

    -fx-background-color: #FFE3C1;

    -fx-background-inserts: 0.0, 0.0 0.0 0.0 0.0;

    -fx-text-fill:-fx-text-inside-color;

    }

    .list-cell {}

    -fx-alignment: BASELINE_CENTER;

    }

    If you have an idea...

    Thanks in advance.

    Fabrice

    I found the problem: problem of size of parent container!

    Thank you.

  • Problem with drag and drop multiple lines of ListView

    I work on an example application with 2 views of list that is the players and the team and implement drop and drop as players can be deposited to one list to the other. Everything works as expected when there is selection unique model is enabled in the source list view. However, if I have activated several model selection and drag 2 or more lines of source target list view list view, see the following exception after that the decline is over.

    Exception:

    java.lang.IllegalArgumentException: only objects serializable or ByteBuffer can be used as data with the format of data [subListPlayers]

    at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:513)

    at javafx.scene.input.Clipboard.setContent(Clipboard.java:230)

    (1) what should be the DataFormat used to be able to drag and drop multiple lines? Looks like we don't have for the type of object, so I created the following which does not solve the problem.

    private DataFormat dataFormat = new DataFormat ("subListPlayers");

    (2) I made changes to support serialization on the data object that seems no more to solve the problem. Tried by implementing the interface Serializable, as well as the implementation of the Externalize interface.

    Can someone Guide please if there is an easy way to implement this behavior?

    Code:

    
    

    public class player

    {

    private String name;

    public player (String name)

    {

    myIdName = name;

    }

    public String getName()

    {

    return the name.

    }

    public void setName (String name)

    {

    myIdName = name;

    }

    @Override

    public boolean equals (Object o)

    {

    If (this == o) return true;

    If (o == null | getClass()! = o.getClass ()) return false;

    A player = o (player);

    If (name! = null? name.equals (player.name): player.name! = null) return false;

    Returns true;

    }

    @Override

    public int hashCode()

    {

    return the name of! = null? name.hashCode (): 0;

    }

    }

    SerializableAttribute public class JavaFXDnDApplication extends Application

    {

    private final static ListView < drive > playersListView = new ListView < drive > ();

    private final static ObservableList < drive > /playerslist is FXCollections.observableArrayList ();.

    private final static ListView < drive > teamListView = new ListView < drive > ();

    private final static GridPane rootPane = new GridPane();

    private DataFormat dataFormat = new DataFormat ("subListPlayers");

    Public Shared Sub main (String [] args)

    {

    Launch (args);

    }

    @Override

    public void start (point primaryStage)

    {

    primaryStage.setTitle ("Drag and Drop Application");

    initializeComponents();

    initializeListeners();

    buildGUI();

    populateData();

    primaryStage.setScene (new scene (rootPane, 400, 325));

    primaryStage.show ();

    }

    Private Sub initializeListeners()

    {

    playersListView.setOnDragDetected (new EventHandler < MouseEvent >)

    {

    @Override

    public void handle (event MouseEvent)

    {

    System.out.println ("setOnDragDetected");

    Dragboard dragBoard = (TransferMode.MOVE) playersListView.startDragAndDrop;

    ClipboardContent content = new ClipboardContent();

    content.putString (playersListView.getSelectionModel () .getSelectedItem () .getName ());

    Content.put (dataFormat, playersListView.getSelectionModel () .getSelectedItems ());

    dragBoard.setContent (content);

    }

    });

    teamListView.setOnDragOver (new EventHandler < DragEvent >)

    {

    @Override

    public void handle (DragEvent dragEvent)

    {

    dragEvent.acceptTransferModes (TransferMode.MOVE);

    }

    });

    teamListView.setOnDragDropped (new EventHandler < DragEvent >)

    {

    @Override

    public void handle (DragEvent dragEvent)

    {

    String player = dragEvent.getDragboard () .getString ();

    ObservableList < drive > drive = dragEvent.getDragboard () .getContent (dataFormat) (< drive > ObservableList);

    String player = dragEvent.getDragboard () .getString ();

    teamListView.getItems () .addAll (New Player (player));

    playersList.remove (new Player (player));

    dragEvent.setDropCompleted (true);

    }

    });

    }

    Private Sub buildGUI()

    {

    rootPane.setGridLinesVisible (true);

    rootPane.setPadding (new Insets (10));

    rootPane.setPrefHeight (30);

    rootPane.setPrefWidth (100);

    rootPane.setVgap (20);

    rootPane.setHgap (20);

    rootPane.add (playersListView, 0, 0);

    rootPane.add (teamListView, 1, 0);

    }

    Private Sub populateData()

    {

    () playersList.addAll

    New Player("Adam"), New Player("Alex"), Player ("Alfred") New Player("Albert") new,.

    New Player("Brenda"), New Player("Connie"), Player ("Derek") new new Player ("Donny").

    Player ("Lynne") new, New Player ("Myrtle"), Player ("pink") New Player("Rudolph") new,.

    Player("Tony") new, New Player ("Trudy"), Player ("Williams") New Player ("Zach") new

    );

    playersListView.setItems (playersList);

    }

    Private Sub initializeComponents()

    {

    playersListView.setPrefSize (250, 290);

    playersListView.setEditable (true);

    playersListView.getSelectionModel () .setSelectionMode (SelectionMode.MULTIPLE);

    playersListView.setCellFactory (new reminder < < drive > ListView, ListCell < drive > > ())

    {

    @Override

    public call for ListCell < drive > (ListView < drive > playerListView)

    {

    return again ListCell < drive >)

    {

    @Override

    protected void updateItem (player, boolean b)

    {

    super.updateItem (reader, b);

    If (player! = null)

    {

    setText (player.getName ());

    }

    }

    };

    }

    });

    teamListView.setPrefSize (250, 290);

    teamListView.setEditable (true);

    teamListView.getSelectionModel () .setSelectionMode (SelectionMode.MULTIPLE);

    teamListView.setCellFactory (new reminder < < drive > ListView, ListCell < drive > > ())

    {

    @Override

    public call for ListCell < drive > (ListView < drive > playerListView)

    {

    return again ListCell < drive >)

    {

    @Override

    protected void updateItem (player, boolean b)

    {

    super.updateItem (reader, b);

    If (player! = null)

    {

    setText (player.getName ());

    }

    }

    };

    }

    });

    }

    }

    
    

    Yes, it is a pain. I filed https://javafx-jira.kenai.com/browse/RT-29082 earlier. Go ahead and vote in favour if you're inclined...

    I think that the problem in your case, it is the observable list provided by MultipleSelectionModel.getSelectedItems () is not serializable. So even if you make your player Serializable class, the list is not. The first thing I would try, I think, is to make player implements Serializable and pass in an ArrayList instead of the observable list. If you can do

    content.put(dataFormat, new ArrayList(playersListView.getSelectionModel().getSelectedItems()));
    

    and

    List player = (List) dragEvent.getDragboard().getContent(dataFormat);
    teamListView.getItems().addAll(player);
    

    If it does not, a solution is simply to store the "slipped" into a property list:

    final ListProperty draggedPlayers = new SimpleListProperty();
    //...
    // Drag detected handler:
    content.putString("players");
    draggedPlayers.set(playersListView.getSelectionMode().getSelectedItems());
    
    // Drag dropped handler:
    if (dragboard.hasString() && dragboard.getString().equals("players")) {
         teamListView.getItems().addAll(draggedPlayers.get());
         draggedPlayers.set(null);
    }
    
  • problem adding ListView to a container

    I first add the ListView to a container. And then, after a particular condition, I delete this container and creates a new container. And then I try to add that again to the newly created ListView from container. But it crashes when I try to add them.

    if(currentPageContainer)
    {
        currentPageContainer->remove(listView);
        delete(currentPageContainer);
    }
    
    currentPageContainer = new Container;
    currentPageContainer->add(listView); // crashes here
    

    If I does not remove the container then it works fine.

    Hello

    Documentation:
    Once the control is removed, the container is no longer made reference, but it is still owned by the container.

    Try adding
    listView-> setParent)
    After removing the listView of the container, but before you delete the container.

    In addition, I propose to replace "delete (...). with "delete currentPageContainer" to avoid accidentally calling a function. Delete is an operator.

    On this line:
    currentPageContainer = new container;
    I suggest to define a parent: new Container (this) etc to avoid deleting explicitly in the destructor. It's ok to delete the object by using the delete operator even if the parent is defined.

Maybe you are looking for

  • Firefox crashes when you open a new window

    Firefox normally opens and runs until I properly - close all windows. When zero windows are present, and I go back to Firefox and ask for a new window, Firefox crashes. To solve the problem I have to force quit the application, which generates an App

  • HP pavilion 15-b100: QEnter password administrator or power on password

    OLA, um rectangulo azul apareceu no ecra meu pc as diz "power on password or administrator password. APOs try 3 vezes appears a 75766700 want. Alguem me pode help?

  • All-in-one HP Deskjet 3525: error 0XB808DEDE on wifi connect

    I have a HP Deskjet 3525 multifuntional printer. My ISP changed the modem with a new wifi router included. When I connecrt the printer to the wireless network, the Connectine is made, then the printer gives the following error code: 0XB808DEDE. The e

  • AE1000 Setup does not

    Just tried to set up my wireless adapter and after he tells me to plug my adapter that I receive. Setup wireless adapter requires that wireless connections are managed by Microsoft windows. Error description: other Wireless Manager Name of the model:

  • HP Officejet Pro 8500 8500 landscape with columns

    Windows 7 64 bit system prints out of the page with the landscape and 2 columns using Word 2007