[TIMOB-16975] BlackBerry: AlertDialog button clicks always returning the same index and cancel value
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-22T17:26:46.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 3.3.0, Release 3.4.0 |
Components | BlackBerry |
Labels | n/a |
Reporter | Chris Barber |
Assignee | Pedro Enrique |
Created | 2014-05-16T20:55:20.000+0000 |
Updated | 2014-06-10T20:41:10.000+0000 |
Description
From an AlertDialog, button clicks emit the same source and index in the event object. The index should be different for each button.
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();
PR for Master: https://github.com/appcelerator/titanium_mobile_blackberry/pull/237 PR for 3.3.X https://github.com/appcelerator/titanium_mobile_blackberry/pull/238
Tested and verified fixed with: Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406061445 Titanium SDK, build: 3.3.0.v20140609184912 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-beta npm@1.3.2 titanium@3.3.0-beta2 titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1)
Actual result
different index clicking different buttons(e.g. Confirm Cancel Help)