1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default Answered: How do I use setPressedButtons?

    Answered: How do I use setPressedButtons?


    I'm working with a SegmentedButton and I need to be able to reset all buttons to pressed=false after they're pressed.

    The reason for this is that I don't want a toggle button, but more of an action link kind of button... (press this, navigate to this view).

    How do I use 'setPressedButtons' to achieve this? Or is there another/better way to go about doing what I need?

  2. This should do it:

    Code:
    segmentedButton.setPressedButtons([]);

  3. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    This should do it:

    Code:
    segmentedButton.setPressedButtons([]);
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #3
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default


    Quote Originally Posted by rdougan View Post
    This should do it:

    Code:
    segmentedButton.setPressedButtons([]);
    Thanks rdougan. I tried the following and got this error

    PHP Code:
                    toggle: function(containerbuttonpressed){
                        var 
    buttonText button.getText();
                        
    console.log('User: buttonPress ~ "' buttonText '"');


                        if(
    buttonText === 'videos'){
                            
    // todo: activate the videos view
                        
    }


                        if(
    buttonText === 'calendar'){
                            
    // todo: activate the calendar view
                        
    }
                        if(
    buttonText === 'sites'){
                            
    // todo: activate the sites view
                        
    }
                        
    // reset the button pressed to false.
                        
    button.setPressedButtons([]);
                    } 

    Uncaught TypeError: Object [object Object] has no method 'setPressedButtons'

  5. #4
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default


    Quote Originally Posted by rockinthesixstring View Post
    Thanks rdougan. I tried the following and got this error

    PHP Code:
                    toggle: function(containerbuttonpressed){
                        var 
    buttonText button.getText();
                        
    console.log('User: buttonPress ~ "' buttonText '"');


                        if(
    buttonText === 'videos'){
                            
    // todo: activate the videos view
                        
    }


                        if(
    buttonText === 'calendar'){
                            
    // todo: activate the calendar view
                        
    }
                        if(
    buttonText === 'sites'){
                            
    // todo: activate the sites view
                        
    }
                        
    // reset the button pressed to false.
                        
    button.setPressedButtons([]);
                    } 

    Uncaught TypeError: Object [object Object] has no method 'setPressedButtons'
    Ah, but the container has that method

    Code:
    container.setPressedButtons([]);

Thread Participants: 1