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
New Developer
yogibong
Posts: 16
Registered: ‎10-17-2011
My Device: 9700
Accepted Solution

Custom ActiveTextHandler: handle #hashtag and @mention in Label

Hi all,

In Label control, can we make a custom text handler?

Example: i want to handle "#somehashtag" or "@someuser" when got tapped by user.

 

Currently, if i using standart ActiveTextHandler, only html tag like "http" would be get actions.

 

Thanks.

 

 

Developer
dishooom
Posts: 103
Registered: ‎12-31-2012
My Device: Blackberry 9810

Re: Custom ActiveTextHandler: handle #hashtag and @mention in Label

Hi

 

I doubt if there is anything like a CustomTextHandler apart from an ActiveTextHandler. I feel what you can do to near proximity is create a custom Label in CPP and handle its onTouch to check if the text it has contains your required tag.

 

_Dishooom

 

Hope this helps :Angel:

New Developer
yogibong
Posts: 16
Registered: ‎10-17-2011
My Device: 9700

Re: Custom ActiveTextHandler: handle #hashtag and @mention in Label

Its exist @dishoom. I have BB Z10, twitter application have this functionality.

And if in my application, in label using ActiveTextHandler, whenever there is "@mention" or "#hashtags" the twitter apps can listen and automaticly search for user (@mention) or hashtag.

 

and in blackberry java development this can be achieve using PatternRepository.

Developer
dishooom
Posts: 103
Registered: ‎12-31-2012
My Device: Blackberry 9810

Re: Custom ActiveTextHandler: handle #hashtag and @mention in Label

[ Edited ]

yippee.... :smileyhappy: I think this should work .... :Angel:

 

    Label {
            text: "<html><a href=\"www.w3schools.com;\">Visit W3Schools</a></html>"
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center

            activeTextHandler: ActiveTextHandler {
                onTriggered: {          
                   console.log("Seems to work fine"+event.text);
                }
                
            }
        }

 I have used HTML in the Label text....

activeTextHandler can be used for handling the clicked event...

 

 Note: I havnt gone ahead handling the click... I have just verified it with the logs.... if i m able to get the event.text.

-Dishooom

Contributor
chanzdevilz
Posts: 16
Registered: ‎06-06-2011
My Device: 8520

Re: Custom ActiveTextHandler: handle #hashtag and @mention in Label

are you already got this solution ? could you tell me, how it works?