Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26189] Windows: add buttonClickRequired method on Ti.UI.AlertDialog

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionWon't Do
Resolution Date2019-05-21T01:57:27.000+0000
Affected Version/sRelease 8.0.0
Fix Version/sn/a
ComponentsWindows
Labelsn/a
ReporterMenno Juistdit
AssigneeKota Iguchi
Created2018-07-09T23:36:58.000+0000
Updated2019-05-27T12:33:19.000+0000

Description

Adds the buttonClickRequired property to Ti.UI.AlertDialog, which controls whether the dialog can be cancelled by clicking the system back button. Defaults to true.
var win = Ti.UI.createWindow({layout: 'vertical'}),
	button1 = Ti.UI.createButton({title: 'Cancelable'}),
	button2 = Ti.UI.createButton({title: 'Non-cancelable'}),
	dialog = Ti.UI.createAlertDialog({
		message: 'Message',
		ok: 'OK',
		title: 'Title',
		persistent: true
	});

button1.addEventListener('click', function () {
	dialog.buttonClickRequired = false;
	dialog.show();
})

button2.addEventListener('click', function () {
	dialog.buttonClickRequired = true;
	dialog.show();
})

win.add([button1, button2]);
win.open();

Comments

  1. Kota Iguchi 2019-05-21

    Resolving this as "Won't Do" because Windows UWP MessageDialog component ([Windows::UI::Popups::MessageDialog](https://docs.microsoft.com/en-us/uwp/api/windows.ui.popups.messagedialog)) does not have a way to react to the back button. I have confirmed that Windows 10 Mobile phone treats the back button as a cancel button. The API document for UWP MessageDialog shows that there's [CancelCommandIndex](https://docs.microsoft.com/en-us/uwp/api/windows.ui.popups.messagedialog.cancelcommandindex#Windows_UI_Popups_MessageDialog_CancelCommandIndex) _unsigned_ int property and setting -1 (despite CancelCommandIndex is _unsigned_ int !) to it could be used to ignore dismissal action but I have confirmed that it doesn't actually work.
  2. Samir Mohammed 2019-05-27

    Closing ticket as it is marked as Won't do. If you feel this is a mistake feel free to reopen.

JSON Source