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

Reply
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper
Accepted Solution

Two differents touchable area in a ListItemComponent in a ListView

Hi all,

Here is my problem :

 

I have my ListView with my ListItemComponent including two areas, and i would like to be able to open a different page if I click in an area or on the other.

 

Unfortunately onTriggered is available for all the ListItemComponent.

 

Anyone has got an idea ?

 

Thanks.

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.
Developer
kanaksony
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Two differents touchable area in a ListItemComponent in a ListView

Hi,

 

Have you tried this with Custom ListField.

 

Say u have ListItemComponent as 2 Labels. Now, u can handle onTouch of bothe labels separately.

 

ListItemComponent {
	Container {
		layout: StackLayout {
			orientation: LayoutOrientation.LeftToRight
		}
		Label {
			id: label1 
			text: "Label1
			text: ListItemData.title
			onTouch: {
				//your action for label 1 goes here
			}
		}
		Label {
			id: label2 
			text: "Label2"
			text: ListItemData.description
			onTouch: {
				//your action for label 2 goes here
			}
		}
	} // end of Container
} // end of second ListItemComponent

 

 

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Please use plain text.
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: Two differents touchable area in a ListItemComponent in a ListView

Yes I think about this, but the problem is in a ListItemComponent it seems that I can't catch a component out of it.

 

In my case I can't push a page in my navigationPane : "ReferenceError : Can't find variable : myNavigationPane"

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Two differents touchable area in a ListItemComponent in a ListView

Your list item needs an ID, so to access something from the list view you would do something like this (obviously syntax isnt all correct but you get the idea)

 

ListView{

ListItemComponent {

Container {

id: testitem

Label{

     onTouch { testItem.ListItem.view.pushPage1(ListItemData)

}

}

function pushPage1(data){

//dowhatever

}

}

Like all of my posts
Please use plain text.
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: Two differents touchable area in a ListItemComponent in a ListView

Perfect, thanks.

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.