To access the instance of the ListView onTriggered event ListItemComponent

Hello

I'm pulling out my hair with this!

I have a ListItemComponent in my ListView, and I want to access the component instance in the onTriggered of my ListView. I have the row, but I can't work on how to find the actual view.

Simple example:

{To ListView

ID: myListView

dataModel: myDataModel

layout: {FlowListLayout}
listItemComponents:]
{ListItemComponent}
type: 'imageItem.
{GalleryImages}
}

]

onTriggered: {}

It's easy

var point = dataModel.data (row);

BUT HOW to ACCESS the GalleryImages instance for the row?

}

...

I'm sure it's really simple, but have been hitting my head against it for 2 days!

C

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

your variable 'point' reference the underlying data in the datamodel - it does not refer to the list Visual element (i.e. ListItemComponent).

You need to move your manager in the ListItemComponent - and probably change in notecard or anything that supports your component of GalleryImages.

Tags: BlackBerry Developers

Similar Questions

  • Errors in 'Speed' while accessing the mouse click events?

    Hello

    I built a software where it has a CVI callback function registered on the Panel. The function tests whether two cases, the first EVENT_LEFT_CLICK and then EVENT_LEFT_CLICK_UP. The user is supposed to keep the click button for some time (~ 1 second), and there is no problem. However, I have found that if by mistake (that users commit often) multiple rapid clicks are made, sometimes the click down the piece of event (EVENT_LEFT_CLICK) of the code is not read. I reduced the likelihood of this problem of the speed setting of double click (on Windows) to the maximum.

    I think that if I could eliminate the double click event, this problem would be resolved almost completely and only limited by the speed at which the processor can update mouse events.

    Hope you understand my problem.

    Thank you!!

    AUTOSOLVED.

    Thanks to a guy who posted his own solution on a Windows forum, to 'disable' the double click. Just change the HKEY_CURRENT registry value > ControlPanel > mouse > DoubleClickSpeed to 1. What makes the double click speed so fast that you can access virtually every user actually simple clicks.

    After doing this, in order to apply the registry editing, I ended explorer.exe running and he raised through windows task screen. However, change, this applies to what I opened the mouse Panel (without change or apply anything from there).

  • ListView onTriggered event to push a new page

    Currently, I started to learn and develop applications for bb10. I saw troubled when wants to push a new page when click the item in the listview.

    ListView {
                dataModel: XmlDataModel {
                    source: "model.xml"
                }
    
                listItemComponents: [
                    ListItemComponent {
                        type: "listItem"
                        StandardListItem {
                            title: ListItemData.title
                            description: ListItemData.subtitle
                            status: ListItemData.status
                        }
                    }
                ]
                onTriggered: {
                    var new_page = nextpage.createObject();
                    navigationPane.push(new_page);
                }
    
                attachedObjects: [
                    ComponentDefinition {
                        id: nextpage
                        source: "newqml.qml"
                    }
                ]
            }
    

    The code that I use, I expect to get to the newqml.qml, then click on any point on the listview however is not doing. How can I change the code to obtain the result.

    and if I want it open different page each item in listview how does?

    Thanks in advance.

    Hello

    I'm new on this, but I have a tip that could help: create a new project, select stunts, then on the models page, select ListView.

    This will automatically create a default list that automatically connects your article to an ItemPage.qml of a second!

  • To access the logs of events outside the Simulator Simulator

    We must be able to access a text copy of the Simulator event outside the Simulator logs.

    The goal is to have a tester to be able to send logs of the Simulator to a developer when they run into a problem with the application.

    Does anyone know how to do this?

    In the Simulator: simulate-> USB cable connected

    On the command line: JavaLoader-u eventlog > simulator.log

  • Access to a component (ImageView) inside the ListView

    I have a ListView in which there is an ImageView. When any item is typed, I manage onTriggered Signal. At this signal, I want access the ImageView the ListItem that is typed. How to do this?

    I think that the best workaround is using your own object as a data model to the image property. Then you can change it in onTriggered signal just like that ListItemData.imageSource = newImageSource

    for example:

    // If you are using JSON add a new property which is a imageSource
    
    model.append({"name": "bla bla", "imageSource": "bla bla"})
    

    or write a derivered of QObject class as in this example

    https://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__GroupDataModel.html

    but hope that you use GroupDataModel

    Another solution is to write your own function and use instead onTriggered

    for example (I like examples of the )

    ListView{
    
        function myOwnFunction(indexPath, imageView){
            var item = dataModel.data(indexPath);
            if (item){
                // set new image
            }
        }
    }
    
    // And access it from ListItemComponent
    
    ListItemComponent {
        type: ""
        Container {
            id: root
    
            onTouch{
                root.ListItem.view.myOwnFunction(root.ListItem.indexPath, imageView)
            }
        }
    
  • 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

  • Access CPP of the ListView in QML function

    ListView {
                id: listView
                dataModel: dataModel
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.title
                            description: app.formatDate(ListItemData.pubDate);
                        }
                    }
             ]
    }
    

    and in the PRC

    QString ApplicationUI::formatDate(QString date) {
        return "bla";
    }
    

    Function call leave outer ListView works well, but I cannot access any function defined outside ListView!

    In this case, I get asset:///blabla.qml:16: ReferenceError: can't find variable: app

    How can I call it?

    For some strange reason the listItemComponents are outside the normal code flow. But you can bypass. Give your listItemComponent a name/id. You can reference it trough the parent ListView. Something like this should work:

    StandardListItem {
     id: mscurli
     title: ListItemData.OriginalTitle;
     description: ListItemData.TheatreAndAuditorium
     status: mscurli.ListItem.view.getShowTime(ListItemData.dttmShowStart);
    }
    

    I used a set inside my ListView simple helper function to get the C++ code:

    function getShowTime(str) {
     return _myapp.formatTime(str);
    }
    
  • Not able to access the parent instance variable in outside of the methods in child

    Hello

    I don't get why I am not able to access the instance variable parent class apart from the example of the child class methods.
    class Parent
    {
         int a;
    }
    
    class Child extends Parent
    {
         a = 1; // Here i am getting a compilation error that Syntax error on token "a", VariableDeclaratorId expected after this token
         
         void someMethod()
         {
              a = 1;  // Here i am not getting any compilation error while accessing parent class variable
         }
    }
    Can someone let me know the exact reason for this, and what about the talks of error?

    Thank you
    Uday

    Published by: Udaya Shankara Gandhi on June 13, 2012 03:30

    You can only put assignments or expressions inside the methods, of the builders or the initializors class, or when you declare a variable.
    It has nothing to the child which stretches from Parent.

    class Parent {
        int a = 1;
    
        { a = 1; }
    
        public Parent() {
            a = 1;
        }
    
       public void method() {
           a = 1;
       }
    }
    
  • Access the mobile nodes in a ListView

    How can I access the nodes of the cell (listcells) in a listview?

    For example, if I want to increase the size (specifically, the height) of the cells?

    You must write a CellFactory for your ListView, like this:

            ObservableList items = FXCollections.observableArrayList("String1", "String2", "String3");
    
            ListView listView = new ListView();
            listView.setItems(items);
            listView.setCellFactory(new Callback, ListCell>() {
                @Override
                public ListCell call(ListView stringListView) {
                    ListCell cell = new ListCell() {
                        protected void updateItem(String item, boolean empty) {
                            super.updateItem(item, empty);
                            if (item != null) {
                                setText(item);
                            }
                        }
                    };
                    cell.setPrefHeight(100);
                    return cell;
                }
            });
    

    Usually, you will probably want to write your own class for the cell factory.

    You can assign a height or you can add a style class to your cell and use the fill in CSS.

    (I don't know why you cannot set directly on the cell fill.)

  • Access the current instance of request module in a java class in the model

    Hi all
    I'm trying to implement the custom story types in our application, (ModifiedById), I can read the user name of the security context, but not the username.
    I have a view object, say UserInfoVO which contains the logged in users info.
    I know, I can create a new instance of the application at the bean module and using security context information, I can go get the user ID.
                ApplicationModule am =
                      Configuration.createRootApplicationModule(amDef, config);
                    ViewObject vo = am.findViewObject("UserInfoVO1"); // view criteria applied by default
                    vo.setNamedWhereClauseParam("bUserName", user); // user from security context
                    vo.executeQuery();
    I'm trying to access the current instance of the Application module in my java class customized, that is used to return the attribute history ModifiedById.
    //referring the blog
    
    http://jobinesh.blogspot.in/2011/02/creating-custom-history-types.html
    It is, how do I access the current instance of ApplicationModule in a class as * "HistoryAwareEntityImpl" * located in project template. ?

    any help will be appreciated.

    Kind regards
    Rognard

    OK, in this case, you get the transaction of db of the base class object and this object allows you to search the module of the application

    public final DBTransaction getDBTransaction();
    ...
    DBTransaction:
    public ApplicationModule findApplicationModule(java.lang.String amName)
    

    or if you get the application root module

    public ApplicationModule getRootApplicationModule()
    

    Timo

  • A custom object to access class instance to the

    I created a few (TextInput, ComboBox, CheckBox) instances of the component (created as a public objects) in a Document class and added to the scene.

    Now, I created a class customized to a movieclip in the library and instantiated in the class of document (also a public proceeding).

    I need to access instances of the component in the custom class. How to do this?

    Also, it is advisable to use the ENTER_FRAME event frequently? because if I can't access the instances of components in the custom class above then I will remain no other choice than to use ENTER_FRAME event in the document class whenever I have to change a value in the components...

    So, is this a good practice?

    I think you're overloading the things why don't you just leave your document class adds a TextInput, and your button as his children? Then you can access both of them the class of document with ease.

  • How to access the instance property of the main class via child class

    Hi I hv done 3 classes objecthandler, box and nav

    NAV is child chass objecthandler, I hv make an instance of objecthandler box and now I want to access the property of box via NAV... See the code

    Class Objecthandler

    package code {}
    import flash.display.MovieClip
    import code.box
    import code.nav

    public class objectHandler extends MovieClip {}
    public var container: box
    public var navigation: nav

    public void addObjects() {}

    Navigation = new nav()
    addChild (navigation)
    navigation.addEvents)
    navigation.x = 275
    navigation.y = 400

    container = new box()
    addChild (container)
    putcontainer ("default")< < works well here
    }
    public void putcontainer(page:String) {}
    Container.OpenPage (page) < < when this function is executed it returns ("page is open"+ page)
    }
    }
    }

    Class of NAV

    package code {}
    import flash.display.MovieClip
    import flash.events.MouseEvent
    import flash.display.DisplayObjectContainer
    import code.box

    public class nav extends objectHandler {}
    public void nav() {}

    }

    public void addEvents() {}
    homeBtn.addEventListener (MouseEvent.CLICK, releaseFun)
    galleryBtn.addEventListener (MouseEvent.CLICK, releaseFun)
    productsBtn.addEventListener (MouseEvent.CLICK, releaseFun)
    contactBtn.addEventListener (MouseEvent.CLICK, releaseFun)
    }

    public void releaseFun(event:MouseEvent):void {}
    putcontainer(Event.currentTarget.Name) < < showing the error over here
    }
    }
    }

    You should review your logic.

    It is not supposed have nav extend objectHandler and then has an objectHandler method that creates a new instance of nav.

  • To access the upper class instance variables

    Hello

    See the code provided below. If home * variable 'i' is not set to 4, the output will be 3, if it is set, it will be 4.
    My question is... Well, I don't know exactly, there would be a lot. All this is strange to me.
    (For example, it seems that for the super class constructor runs when I access an instance of her variable).
    Could someone explain this topic or maybe help me to direct to an article?
    public class TryThis {
        
        public static void main (String args[]){
    
             Child c = new Child();
             c.seeSuper();   
        }
    }
    
    public class Parent {
    
         int i;
         
         Parent(){
              i = 3;
         }
    }
    
    public class Child extends Parent{
    
         Child(){
              //i = 4;  //***
         }
         
         public void seeSuper(){
              System.out.println(super.i);
         }
                        
    }
    Note: Parent could also simply look like this:
    public class Parent {
         int i = 3;
    }

    I see now that it is wrong to use the word 'object '.

    No, it isn't.

    they are there for the child to use, object

    That's where you're going wrong. Don't think about "the parent" and "child object. There is only one object, and it is mentioned by "this". You should think about members of the base or the classes and members of the (current) derived class. They are all members of the 'object', but the members of the base class can be hidden by the current members of class with the same name. That's all. Nothing too special about it.

    but they aren't the fields of it.

    Yes they are, but if they are hidden by local declarations that they are not visible to 'this', only to 'super '.

  • How can I access all instances of the itemRenderer in a specific DataGridColumn?

    How can I access all instances of the itemRenderer in a specific DataGridColumn? Or, if I have a rowIndex and columnIndex, how do I get the itemRenderer to these clues?

    I use States to change the display of my itemRenderer of a TextField of a PopUpMenuButton. What I was trying to do was change back the display of all the other itemRenderers visible in the column of the textfield, when one of the itemRenderers displays the PopUpMenuButton.

    I tried to loop through all of the itemRenderers in the column and casting them as the class I was using and then by setting the currentState, but, it wasn't good performance wise and required too code. I simplified it listen to a change on the listData owner event (in my case a DataGrid, but any component ListBase) and by setting the currentState to null when it is triggered. Works like a charm.

  • Can not access the context property of the Interior of the ListView checkbox - onCheckedChange event

    I have a context property called "app" that connects to my C++ application. My listview has a box with onCheckedChange event listener. In this method, when I make a call to the C++ side. application app.runAction, the system displays not found error app.

    If I move the box outside the list view, it will correctly trigger app.runAction.

    Can you please take a look? Thank you!

    On the side of C++ on how I set the context property.

    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);

    If (qml-> {hasErrors())}
    Returns false;
    }

    QML-> setContextProperty ("app", this);

    navigationPane = qml-> createRootObject();
    If (! navigationPane) {}
    Returns false;
    }

    QML side

     

    NavigationPane {}
    ID: nav

    {Page}
    ID: mainPage
    {Of container

    {To ListView

    listItemComponents:]
    {ListItemComponent}
    type: 'point '.
    {Of container

    Checkbox {}
    Determine whether the check box should be checked
    According to a value in the data model
    checked: ListItemData.checked
    onCheckedChanged: {}
    app.testAction ();
    }
    }

    This is a scope issue... I really hope the devs find a way to fix it properly apart from this ugly solution:

    You can solve this problem by setting your app variable in the global object Qt

    NavigationPane {
        id: nav
    
    onCreationCompleted: Qt.app = app
    
    Page {
            id: mainPage
            Container {
    ListView {
    listItemComponents: [
            ListItemComponent {
                            type: "item"
                            Container {
                       CheckBox {
                                    // Determine whether the CheckBox should be checked
                                    // according to a value in the data model
                                    checked: ListItemData.checked
                                    onCheckedChanged: {
                                         app.testAction();
                                         Qt.app.testAction();
                                    }
                                }
    

    all code in a ListItemComponent will suffer from this 'framing' question

Maybe you are looking for

  • Duplication of images

    I just bought lenovo laptop Z570. Configuration: i5, 4 GB ram, I GB nvidia, dos mode... Bit installed windows 7 ultimate 32... installed all the drivers including Intel graphics & nvidia graphics... What bothers me is that images of other part of the

  • latest version of the driver for keithley 2400 sourcemeter instument

    Hi all I'm unable to connect with sourcemeter Keithley 2400 with GPIB / Rs232. (currently using the driver from keithley Web site) I did a search preliminary Forum and learned that there is some bugs in drivers. Then comes the last avilable pilot sit

  • unknown table to the LV9 chart size

    The attached program is used to measure a device at work, which currently has 3-band, for an indefinite period. It works great (although I'm sure that it is not written in recommended NEITHER!). My problem is changing the software to test devices tha

  • Write to the named Excel range

    Hello I'm using LabVIEW 10 on windows 7 32 bit Prof I read leave an excel named range, which I can bring in a table 2d (form control) I so want to be able to change the values in this table 2d and then write back to the same Beach named and saved in

  • I got a call from people claiming that there was a problem with the computer.

    Original title: scammed by PCWizards? A few days ago I received a call from PC assistants saying they were Windows operating system support. They tell me that they have noticed that I had many requests from spam junk that was slowing down my computer