1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    79
    Vote Rating
    1
    jonathansimmons is on a distinguished road

      0  

    Default Custom toolbar buttons best practices.

    Custom toolbar buttons best practices.


    I'm looking for some direction in how to best program the toolbar for my app.

    Currently I'm creating a toolbar and all it's relevant buttons along with my main viewport. When the app starts I hide all the buttons. Then using the each cards "activate" listener and the setVisible() function to show/hide the relevant buttons as I need them.

    This seems to work but it's been buggy and before I go to much further I'd like to see what others are doing.

    For those curious my show hides code is something like this:
    Code:
    if (mainWrapper.Header.items.items[0].hidden == true) {
        mainWrapper.Header.items.items[0].setVisible(true)
    }
    if (mainWrapper.Header.items.items[1].hidden == false) {
        mainWrapper.Header.items.items[1].setVisible(false)
    }

    EDIT:
    After some digging I found that I needed to use .isHidden() rather than just hidden which seems to have fixed any glitches I was seeing. I'd still love to hear anyone suggestions if they know a better way.

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    93
    Vote Rating
    3
    eyepoker is on a distinguished road

      0  

    Default


    if you put id's on your buttons you can use the show() and hide() methods on them, like:

    Ext.getCmp('button_one').hide();

    After that, my approach would be to not bother about checking if something is hidden or not. I would write a function to handle the visibility of all of the buttons where the very first thing it would do is to loop through an array of button id's and hide() everything. After that, I'd show what needs to be shown. For example:

    Code:
    function setAllButtons(){
         // first hide everything
         var btnIds = ['button-1','button-2','button-3','button-4','button-5','button-6','button-7'];
          for (var i=0;i<btnIds.length;i++){
               Ext.getCmp(btnIds[i]).hide();
          }
           // next show only what is needed
          var currentPanel = rootPanel.getActiveItem().getId();
          if (currentPanel == 'panel-1'){
                Ext.getCmp('button-1').show();
                Ext.getCmp('button-2').show();
          } else if (currentPanel == 'panel-2'){
                Ext.getCmp('button-6').show();
                Ext.getCmp('button-7').show();
          }
          // ... etc...
    }

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi