1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    31
    Answers
    1
    Vote Rating
    0
    pvmagacho is on a distinguished road

      0  

    Default Answered: Painted event in Navigation View

    Answered: Painted event in Navigation View


    I am trying to use the painted event of a Container that is pushed into a Navigation View, because I need to get an element position inside the Container:

    ex:
    'main' is the navigation view

    Code:
    main.push({
          xtype: 'container',
          listeners: [
                {
                    fn: 'onContainerPainted',
                    delay: 500,
                    event: 'painted'
                }
            ]
            onContainerPainted: function(component, options) {
                    var box = component.down('#myId').element.getBox();
                    // do something with box
            }
    });
    However, because of the animation of the navigation view I have to add a delay to the painted event (as shown above) otherwise the position retrieved by the getBox function is not correct.

    Is there any way to fire an event only after the push/pop animation ends ? I've also tryed the push/pop event, but that did not work either since these events are fired before the painted event.

    Thank you.

  2. For any Panel that uses card layout the following code works pretty well.

    Code:
            Ext.Viewport.getLayout().setAnimation({
                type: 'slide',
                duration: 200
            });
            var animation = Ext.Viewport.getLayout().getAnimation();
    
            animation.on({
                        animationend: function() {
                            // do stuff
                        },
                        scope: Ext.Viewport, 
                        single: true
            });
    
            Ext.Viewport.setActiveItem(Ext.create('MyApp.view.NextView'));

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3357
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Instead of painted, have you tried activated?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    31
    Answers
    1
    Vote Rating
    0
    pvmagacho is on a distinguished road

      0  

    Default


    I will try that out.

    What is the difference between both events ?
    After the acvitate event, will the DOM will already be all in place in the same way as the painted event ?

    Thank you.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3357
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    painted fires right before the elements are inserted into the DOM. The activate event fires when that component is made active by the container (in this case the nagivation view).
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    31
    Answers
    1
    Vote Rating
    0
    pvmagacho is on a distinguished road

      0  

    Default


    I am still a bit confused.

    From the documentation I have the following statements:
    activate: "Fires whenever item within the Container is activated"
    painted: "Fires whenever this Component actually becomes visible (painted) on the screen. This is useful when you need to perform 'read' operations on the DOM element, i.e: calculating natural sizes and positioning."

    Since I need to know the Container position, I've used the painted event. From what you're saying is that the activate event will be fired after the painted event and with the final position of the elements, when the animation of the navigation view has ended, correct ?

    Thanks,

  7. #6
    Sencha User
    Join Date
    Jul 2011
    Posts
    31
    Answers
    1
    Vote Rating
    0
    pvmagacho is on a distinguished road

      0  

    Default


    I've tested with both activated and painted. However, both of them did not work. I need to attach to the animationend event, but this is fired privately.

    Any help on how to attach to end of the animation of the push event on a navigation view ?

    Thanks

  8. #7
    Sencha User
    Join Date
    Jul 2011
    Posts
    31
    Answers
    1
    Vote Rating
    0
    pvmagacho is on a distinguished road

      0  

    Default


    For any Panel that uses card layout the following code works pretty well.

    Code:
            Ext.Viewport.getLayout().setAnimation({
                type: 'slide',
                duration: 200
            });
            var animation = Ext.Viewport.getLayout().getAnimation();
    
            animation.on({
                        animationend: function() {
                            // do stuff
                        },
                        scope: Ext.Viewport, 
                        single: true
            });
    
            Ext.Viewport.setActiveItem(Ext.create('MyApp.view.NextView'));

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar