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
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

How to handle ActiveTextTriggeredEvent in ListView item?

Hi,

 

Assume I have a list view, and I use something like below in list item:

TextArea {
    id: statusTextArea
    text: "<html>" + someText + "</html>"
    editable: false
}

And I use onTriggered() signal of the list view to push a detail page of the item.

 

How ever, if there is a hyper link, I do not want to push the detail page, but just open the browser to show the url.

 

Now what I observed is that it does both: pushes the new page and openes the browser...

 

Anyone has an idea of how to deal with this issue?

 

Thanks,

Dong

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to handle ActiveTextTriggeredEvent in ListView item?

[ Edited ]

The following workaround comes to mind:

 

1) Listen for URL clicks using ActiveTextHandler. Save the current time when URL was clicked.

 

2) In onTriggered() handler do not push the details page immediately. Schedule a timer to fire after some delay, for example 100 msec. When timer fires, check if URL click was registered by ActiveTextHandler during last 100 ms. If not, then push the page.

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: How to handle ActiveTextTriggeredEvent in ListView item?

Good work around, let me have a trySmiley Happy Thanks.

 

Dong

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to handle ActiveTextTriggeredEvent in ListView item?

You're welcome. Smiley Happy Btw, onTriggered is called twice: for touch & for release events. Make sure you're calling "if (event.isUp()) ..."

Andrey Fidrya, @zmeyc on twitter