Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-1512

Android: OptionMenu is not working with TabGroup

    Details

      Description

      I've tested Option menu with normal window, it's working fine. However I can't get it working with TabGroup.

      Test code:

       
      var win1 = Ti.UI.createWindow({
          backgroundColor: 'blue',
          fullscreen: false
      });
      var tab1 = Ti.UI.createTab({
          window: win1,
          title: 'Tab 1'
      });
       
      var win2 = Ti.UI.createWindow({
          backgroundColor: 'yellow'
      });
      var tab2 = Ti.UI.createTab({
          window: win2,
          title: 'Tab 2'
      });
       
      var tabGroup = Ti.UI.createTabGroup({
      	activity: {
              onCreateOptionsMenu: function(e) {
                  var menu = e.menu;
                  var menuItem = menu.add({
                      title : "Item 1",
                      itemId: 1
                  });
                  var menuItem2 = menu.add({
                      title : "Item 2",
                      itemId: 2
                  });
                  menuItem.addEventListener("click", function(e) {
                      Ti.API.info("Item1 was clicked");
                  });
                  menuItem2.addEventListener("click", function(e) {
                      Ti.API.info("Item2 was clicked");
                  });
              },
              
              onPrepareOptionsMenu: function(e) {
              	var menu = e.menu;
              	if (tab1.active) {
              		menu.findItem(1).setVisible(false);
              		menu.findItem(2).setVisible(true);
              	}
              	
              	if (tab2.active) {
              		menu.findItem(1).setVisible(true);
              		menu.findItem(2).setVisible(false);
              	}
              }
          }
      });
        
      tabGroup.addTab(tab1);
      tabGroup.addTab(tab2);
      tabGroup.open();
      
      

      1. Click on menu/optionMenu button, should see "Item 2" in tab1 and "Item 1" in tab2.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                borey Borey
                Reviewer:
                Ping Wang
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-1384
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration