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

iOS optionDialog clickEvent.cancel should be boolean

    Details

      Description

      {html}<div><p>Problem:</p>
      <p>According to the docs*, the <code>cancel</code> property of the
      <code>optionDialog</code> click event is a "boolean to indicate if
      the cancel button was pressed", but it is the index of the button
      that was originally passed to the
      <code>createOptionDialog</code>.</p>
      <p>Example:</p>
      <pre>
      <code class="javascript">// index 4 is the cancel button
      var opts = ['a', 'b', 'c', 'd', 'Cancel'];

      var dialog = Ti.UI.createOptionDialog({
      title: 'Test',
      options: opts,
      cancel: opts.length -1
      });

      dialog.addEventListener('click', function(e) {
      Ti.API.info(e);
      })</code>
      </pre>
      <p>When clicking the 'Cancel' option with the above code, the
      result is:</p>
      <pre>
      <code>[INFO] {
      cancel = 4;
      destructive = "-1";
      index = 4;
      source = "[object TiUIOptionDialog]";
      type = click;
      }</code>
      </pre>
      <p>Expected result:</p>
      <pre>
      <code>[INFO] {
      cancel = True;
      destructive = "-1";
      index = 4;
      source = "[object TiUIOptionDialog]";
      type = click;
      }</code>
      </pre>
      <p>So this is either a bug in the click event object construction
      or the documentation.</p>
      <p>I'm using 1.5.1.</p>
      <p>[*] <a href=
      "http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.OptionDialog-object">
      http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI....</a></p></div>{html}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ngupta Neeraj Gupta
                Reporter:
                ernesto Ernesto
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code