Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Getting flickMode of Listview in cpp

Hi all,

 

I have a horizontal listview with flickmode. Did any one know how to catch the event flickmode in cpp?

Highlighted
Developer
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: Getting flickMode of Listview in cpp

i am pasting my qml and cpp code.

 

QML :CustomListView

Container {
    
    ListView {
        property variant layoutFrame
        property variant visibleItemData 
       
        id: horizontal_listview
        objectName: "horizontal_listview"
        dataModel: XmlDataModel { source:"datamodel_full.xml" }
        layout: StackListLayout { orientation: LayoutOrientation.LeftToRight } // Works fine with any orientation
        snapMode: SnapMode.LeadingEdge
        flickMode: FlickMode.SingleItem
        scrollIndicatorMode: ScrollIndicatorMode.None
        attachedObjects: [
            LayoutUpdateHandler { onLayoutFrameChanged: horizontal_listview.layoutFrame = layoutFrame }//, 
           // ListScrollStateHandler { onFirstVisibleItemChanged: horizontal_listview.visibleItemData = dataModel.data(firstVisibleItem) }
        ]
        listItemComponents: ListItemComponent {
            type: "__carouselitem" 
            
            Container {
                preferredHeight: ListItem.view.layoutFrame.height
                preferredWidth: ListItem.view.layoutFrame.width
                
                layout: DockLayout { }
                ImageView {
                    id:bgimg
                    imageSource: ListItemData.imgsrc
                }
            } // end Container
        } // end ListItemComponent
        
        function itemType(data, indexPath) {
            var type = horizontal_listview.dataModel.itemType(indexPath);
            return "__carouselitem";
        }
        
    }
}

 

 

My Cpp:

CustomListView::CustomListView() {
	// TODO Auto-generated constructor stub
	 QmlDocument *qml = QmlDocument::create("asset:///CustomListView.qml");
	 custom_listview_container = qml->createRootObject<Container>();
	 horizontal_listview = new ListView();
	 horizontal_listview = custom_listview_container->findChild<ListView*>("horizontal_listview");

	 connect(horizontal_listview,SIGNAL(flickModeChanged(bb::cascades::FlickMode::Type flickMode)),this,SLOT(onClickListItem(bb::cascades::FlickMode::Type flickMode)));

}

void CustomListView::onClickListItem(bb::cascades::FlickMode::Type flickMode){
	qDebug()<<" onClickListItem ";
}

 But i am not able to connect the flickmode of listview. Please let me know what i am doing wrong. 

Developer
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: Getting flickMode of Listview in cpp

 mistake. Got it.