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
xnike
Posts: 59
Registered: ‎11-04-2011
My Device: PlayBook, DAC, STL100-1, STL100-2
My Carrier: MTS RUS

Why I can't change TitleBar.scrollBehavior value in runtime?

I create a title bar for the page. On Z10 title bar is sticky by default, but on Q10 is nonSticky. I'd like to make titlebar sticky (unscrollable) in case of expanded titlebar area, but no luck:

 

titleBar: TitleBar {
    id: jPageTitleBar
    kind: TitleBarKind.FreeForm
    kindProperties: TitleBarProperties {

        // set jPageTitleBar.scrollBehavior = TitleBarScrollBehavior.Sticky if expanded

        // and jPageTitleBar.scrollBehavior = TitleBarScrollBehavior.Default if not expanded

    }

}

 

I see in the output messages: "TitleBar::setScrollBehavior() scrollBehavior property cannot be modified after creation, setting ignored"

 

Why BBRY done this and maybe someone know a w/a?

I don't want to waste a part of Q10 small screen to show constantly titlebar and create just another one bicycle.

Please use plain text.
Developer
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10
My Carrier: Telus

Re: Why I can't change TitleBar.scrollBehavior value in runtime?

Not really sure why you're getting that error. Try doing this though:

    scrollBehavior: if (expanded){
        return TitleBarScrollBehavior.NonSticky
    } else {
        return TitleBarScrollBehavior.Sticky
    }

I'm pretty sure that way works, and would be the correct way to do it.

__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Please use plain text.
Developer
xnike
Posts: 59
Registered: ‎11-04-2011
My Device: PlayBook, DAC, STL100-1, STL100-2
My Carrier: MTS RUS

Re: Why I can't change TitleBar.scrollBehavior value in runtime?

Doesn't work at 10.2.0.1047 and 10.2.0.1725:

 

"QDeclarativeExpression: Expression "(function $scrollBehavior() { if (kindProperties.expandableArea.expanded) {return TitleBarScrollBehavior.Sticky} else {return TitleBarScrollBehavior.Default;} })
" depends on non-NOTIFYable properties:
JokesPageTitleBarProperties_QMLTYPE_7::expandableArea
TitleBar::setScrollBehavior() scrollBehavior property cannot be modified after creation, setting ignored"

 

For the code bellow:

 

titleBar: TitleBar {
    id: jokesPageTitleBar
    scrollBehavior: if (kindProperties.expandableArea.expanded) {

        return TitleBarScrollBehavior.Sticky;

    } else {

        return TitleBarScrollBehavior.Default;

    }


    kind: TitleBarKind.FreeForm
    kindProperties: FreeFormTitleBarKindProperties {

        // code

    }

}

Please use plain text.
Developer
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10
My Carrier: Telus

Re: Why I can't change TitleBar.scrollBehavior value in runtime?

Hmm, that's really weird. Maybe it isn't possible to change the scroll behaviour dynamically like that. But that would be kind of stupid. The error message seems to point to that. I'll look into this later but for now I can't help much more. Good luck let me know if you get it.
__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Please use plain text.