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

"ActiveTextHandler is not a type" error

 

Dear Devs,

 

I am encountering a weared problem, I intend to use the active text handler to handle the click of a href in html text, the code following is quite similiar to the sample from https://developer.blackberry.com/cascades/reference/bb__cascades__activetexthandler.html, how ever, when I tried to run it, the error occurs as "

ctiveTextHandler is not a type

                activeTextHandler: ActiveTextHandler {

                                   ^) 

bb::cascades::QmlDocument:createRootObject document is not loaded or has errors, can't create root "

 

Anyone has an idea of what is wrong here? Thanks.

 

TextArea {
    id: statusTextArea
    text: "<html><a href='testurl'>test</a></html>"
    preferredWidth: 728
    inputMode: TextAreaInputMode.Text
    editable: false
    
    textStyle {
        fontSizeValue: 7
    }
    content {
        flags: TextContentFlag.ActiveText
    }
    activeTextHandler: ActiveTextHandler {
        onTriggered: {
            //do something
        }
    }
}

 Thanks,

Dong

Please use plain text.
Developer
contryboy
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: "ActiveTextHandler is not a type" error

Anyone has an idea of the ActiveTextHandler issue?
Please use plain text.
Developer
contryboy
Posts: 68
Registered: ‎08-16-2012
My Device: BB10 Dev Alpha
My Carrier: NA

Re: "ActiveTextHandler is not a type" error

Finally I found a workaround, you need to register the handler:

qmlRegisterType<ActiveTextHandler>("bb.cascades.activetexthandler", 1, 0, "ActiveTextHandler");
qmlRegisterUncreatableType<ActiveTextTriggeredEvent>("bb.cascades.activetexthandler", 1, 0, "ActiveTextTriggeredEvent", "");

 And then import it in QML:

import bb.cascades.activetexthandler 1.0

 Then it will work as expected!

 

Cheers,

Dong

Please use plain text.
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: "ActiveTextHandler is not a type" error

You just saved me a ton of time, contryboy, thanks! Your solution worked perfectly.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.
New Contributor
rajuttam
Posts: 6
Registered: ‎03-03-2013
My Device: BB10
My Carrier: Airtel

Re: "ActiveTextHandler is not a type" error

Great ! Saved my time as well. Thanks man.

Please use plain text.
Contributor
chanduthedev
Posts: 12
Registered: ‎02-19-2013
My Device: Z10
My Carrier: 123456789

Re: "ActiveTextHandler is not a type" error

Thanks. It worked for me as well.

Please use plain text.