Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9053] TiAPI: UI.AlertDialog - click event cancel property parity issue

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2017-06-07T21:27:03.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsTiAPI
Labelsapi, parity
ReporterPaul Dowsett
AssigneeEric Merriman
Created2012-05-08T09:33:19.000+0000
Updated2017-06-07T21:27:03.000+0000

Description

Problem

When the cancel button of an [Titanium.UI.AlertDialog](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.AlertDialog-property-cancel) is clicked, the cancel property on Android returns true whereas iOS returns the [cancel](Titanium.UI.AlertDialog.cancel) property, which will typically not change regardless of the button clicked. As the Android behavior reduces developer code marginally, suggest that iOS be brought in line with it. As the AlertDialog code is so closely related to OptionDialog, OptionDialog should be checked for this issue also.

Test case

            Ti.UI.setBackgroundColor('white');
            var win = Ti.UI.createWindow({  
              title: 'Click window to test',
              backgroundColor: 'white',
              exitOnClose: true,
              fullscreen: false
            });
            win.addEventListener('click', function(e){
              var dialog = Ti.UI.createAlertDialog({
                cancel: 1,
                buttonNames: ['Confirm', 'Cancel', 'Help'],
                message: 'Would you like to delete the file?',
                title: 'Delete'
              });
              dialog.addEventListener('click', function(e){
                if (e.index === e.source.cancel){
                  Ti.API.info('The cancel button was clicked');
                }
                Ti.API.info('e.cancel: ' + e.cancel);
                Ti.API.info('e.source.cancel: ' + e.source.cancel);
                Ti.API.info('e.index: ' + e.index);
              });
              dialog.show();
            });
            win.open();

Comments

  1. Lee Morris 2017-06-07

    Closing ticket due to lack of activity and time passed.

JSON Source