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 Contributor
Blake1024
Posts: 4
Registered: ‎02-09-2013
My Device: Dev Alpha
Accepted Solution

can't disable label re-centering animations?

I have several Labels centered on the screen and I'm periodically changing the text of each of them.  When the new text is a different length than the previous text, the label starts-off with the left side of the text in the same position and then it shifts either left or right to center the new text.  The problem is that I want this shift to happen instantly before the new text is even displayed rather than being animated.  Is it possible to disable implicit animations for this?  I've tried a few different ways and have been unable to do so.  I need to get this fixed this since i'm using other animations on the labels (to move them vertically) but this issue makes them shake around and it doesn't look smooth

Please use plain text.
Developer
steve_web
Posts: 321
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900

Re: can't disable label re-centering animations?


There might be someone with a good answer on disabling the animation... But...

If you can't disable the animation is it possible to hide it temporarily (set the opacity to 0) make the content change and then bring the opacity back?

PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Please use plain text.
New Contributor
Blake1024
Posts: 4
Registered: ‎02-09-2013
My Device: Dev Alpha

Re: can't disable label re-centering animations?

That's possible but if the label goes invisible for the duration of the re-centering animation there's a noticable flicker

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: can't disable label re-centering animations?

You can disable implicit animations on any control. This sample is with a button but it works the same for label

 

Button {
    text: "Hit me!"
    onClicked: {
        // whether any of these settings are animated or not is controlled
        // by allPropertiesController.enabled (which is bound to the the toggle
        // button's checked state)
        translationX = translationX + 10;
        rotationZ = rotationZ + 10;
        opacity = opacity * 0.9;
    }
    attachedObjects: [
        ImplicitAnimationController {
            id: allPropertiesController
            enabled: false
        }
    ]
}

 

Like all of my posts
Please use plain text.
New Contributor
Blake1024
Posts: 4
Registered: ‎02-09-2013
My Device: Dev Alpha

Re: can't disable label re-centering animations?

this doesn't work though, i think because the re-centering animation doesn't really involve a translationX change so it isn't classified as an implicit animation maybe?

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: can't disable label re-centering animations?

Hi,

 

I've tried this code and it changed the label instantly, without animation:

 

import bb.cascades 1.0

Page
{
    Container
    {
        Label {
            id: l
            text: "Test short"
            attachedObjects: [
                ImplicitAnimationController {
                    enabled: false
                }
            ]
        }
        Button {
            text: "Hit me!"
            onClicked: {
                l.visible = false;
                l.text = "Test looooooooooong";
                l.visible = true;
            }
        }
    }
}

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
New Contributor
Blake1024
Posts: 4
Registered: ‎02-09-2013
My Device: Dev Alpha

Re: can't disable label re-centering animations?

thanks dude, it worked!   i didn't even do the implicit animations disable, just setting '.visible' to false while changing the text solved everything

Please use plain text.