Hi
I use this small function to present a dialog with a list of options:¨
function showListBox(title, list, callback, callbackCancel) { list.push(L('button_cancel')); var dialog = Ti.UI.createOptionDialog({ title: title, cancel: list.length-1, options: list }); dialog.addEventListener('click', function(e){ if (e.index === e.source.cancel){ if(callbackCancel) { callbackCancel(-1); } } else { if(callback) { callback(e.index); } } }); dialog.show(); }I add a cancel option to the list sent to the function and tell the optionDialog that this last element is "cancel". However, I would like to handle pressing "Cancel" and pressing on the screen outside of the dialog differently. With the above code I get the "cancelled" index back if the user presses the screen outside the dialog.
The use case where I want to do this is when using the option dialog to give users functions when selecting a location on a map. If the user clicks on the map to move an annotation I just want the dialog to disappear - but not call the "cancel" function. When the user has dropped the pin again I show the dialog box again.
I am using Studio 3.5.0 (on Mac) and the functionality has been tested on iOS so far (but also needs to work on Android).
Thanks!
/John