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

Android: event.cancel not set properly for optionsDialog

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Fixed
    • Affects Version/s: Release 3.3.0, Release 3.4.1, Release 3.5.0
    • Fix Version/s: Release 7.0.0
    • Component/s: Android
    • Labels:
    • Environment:

      Ti SDK 3.2.3.GA and 3.3.0.GA
      Ti CLI 3.3.0
      Mac OS X 10.9.3
      Android 4.4.3

    • Sprint:
      2017 Sprint 20 SDK, 2017 Sprint 21 SDK, 2017 Sprint 22 SDK, 2017 Sprint 23 SDK

      Description

      Problem Description

      When using optionDialog on android the click event returns depending on buttons vs options being clicked.

      even.cancel is true when the cancel button is clicked, however it also gets set to true when the option with same index is clicked or an additional test for event.button needs to be performed. Really this should happen at the SDK level.

      Steps to reproduce

      1. Create a new mobile project (Ti Classic)
      2. Add this to app.js:

       
      var win = Ti.UI.createWindow({
        backgroundColor: 'white',
        exitOnClose: true,
      });
       
      var opts = {
        title: 'Delete File?'
      };
       
      var isAndroid = Ti.Platform.osname == 'android';
       
      if(isAndroid){
        opts.options = ['Confirm', 'Cancel'];
        opts.buttonNames = ['Help'];
        //opts.Help = 0;
      } else {
        opts.options = ['Confirm', 'Help', 'Cancel'];
      }
       
      var dialog;
      win.addEventListener('click',function(){
          dialog = Ti.UI.createOptionDialog(opts);
          dialog.show();
          dialog.addEventListener('click', onSelectDialog);
      });
       
      function onSelectDialog(event){
      	if(isAndroid){
                  //  event.button===true test is necessary 
                  if(event.button === true /*&& event.Help === true*/) alert("ok");
              }
         //alert("ok") ;
      }
       
      win.open();
      

      3. Run it in device.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mchen Maggie Chen
                Reporter:
                ndastur Neville Dastur
                Reviewer:
                Gary Mathews
                Tester:
                Lokesh Choudhary
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code