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

iOS: Remove Ti.UI.ButtonBar "index" property

    Details

    • Story Points:
      3

      Description

      Summary:
      The Ti.UI.ButtonBar is a row of buttons on does not display a "selection" state when a button is tapped like Ti.UI.TabbedBar. Because of this, the Ti.UI.ButtonBar "index" property should be removed since it isn't relevant.

      Issue 1:
      Setting the "index" property should not put a button in the "selected" state.

      1. Run the below code on iOS.
      2. Note that the middle button "Two" is selected. (See attached "Screenshot.png".)
      3. Tap on the middle button.
      4. Notice the selection state is removed.
      5. Tap on the left button.
      6. Notice the left button is not selected. (It shouldn't be selected.)

      Issue 2:
      Fetching the value of property "index" always returns -1 unless fetched during the "click" event

      1. Run the below code on iOS.
      2. Tap on the right-most button.
      3. Notice the 1st logged message "(1) buttonBar.index: 2" has the correct index.
      4. Notice the 2nd message "(2) buttonBar.index: -1" has the incorrect index.
        In this case, it would be better to use the "click" event's "index" property.

      var window = Ti.UI.createWindow();
      var buttonBar = Ti.UI.createButtonBar({
      	labels: ["One", "Two", "Three"],
      	index: 1,
      });
      buttonBar.addEventListener("click", function(e) {
      	Ti.API.info("@@@ (1) buttonBar.index: " + buttonBar.index);
      	setTimeout(function() {
      		Ti.API.info("@@@ (2) buttonBar.index: " + buttonBar.index);
      	}, 10);
      });
      window.add(buttonBar);
      window.open();
      

      Recommended Solution:
      Remove the "index" property. It is not appropriate for this type of UI control. It would be better to use the "click" event's "index" property to identify which button was clicked on.

      Note:
      I think the "index" property exists for this UI control because it shares the same Objective-C code as Ti.UI.TabbedBar. An "index" property makes sense for TabbedBar since it has a selection state.

      This issue is being raised since we want to add ButtonBar to Android and Windows and we don't think the "index" property will make sense on those platforms either.

        Attachments

          Activity

            People

            • Assignee:
              vijaysingh Vijay Singh
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Jan Vennemann
              Tester:
              Samir Mohammed
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code