Class: TaskDialog


Summary

Present the user with a multiple options using a nice interface.


Methods

MethodDescription
 addButton Add a button to the TaskDialog.
 show Show the TaskDialog


Properties

PropertyDescription
 autoCloseTimeout Allows you to get the dialog to close automatically after the given time period.
 buttonPushed This is the ID of the button the user chose.
 defaultButton The ID of the default button. This button is preselected.
 description The descriptive explanation of the question. Can use DigiGuide-style HTML for markup.
 icon Image name to use for the main icon for this TaskDialog
 question The main, large, question that will be used on this TaskDialog.
 title Main title used on the window for this TaskDialog.


Examples

Below is some sample code taken from the default reminder Marker.

var dlg = new TaskDialog;

dlg.icon = "%DGIMAGEDIR%alarm-large.png";
dlg.title = "Add a reminder for " + programme.name;
dlg.question = "What type of reminder should I add?";
dlg.description = "This allows you to choose exactly how you'd like to be reminded when <b>" + programme.name + "</b> is.";

dlg.addButton( 1, "%DGIMAGEDIR%arrow.png", "Any time reminder", "Set a reminder for <b>" + programme.name + "</b> whenever it is on." );
if( !programme.isOld() )
{
dlg.addButton( 2, "%DGIMAGEDIR%arrow.png", "One time only reminder", "Only set a reminder for <b>" + programme.name + "</b> at " + formatTime( programme.startDate ) + " on " + formatLongDate( programme.startDate ) );
}

dlg.addButton( 3, "%DGIMAGEDIR%arrow.png", "Daily reminder", "Set a reminder for <b>" + programme.name + "</b> every day at " + formatTime( programme.startDate ) );
dlg.addButton( 4, "%DGIMAGEDIR%arrow.png", "Weekly reminder", "Set a reminder for <b>" + programme.name + "</b> every " + getDayName( programme.startDate ) + " at " + formatTime( programme.startDate ) );
dlg.addButton( 5, "%DGIMAGEDIR%cancel.png", "Cancel", "Cancel this reminder and return to the previous view" );
dlg.defaultButton=5;

dlg.autoCloseTimeout = 30; // Automatically 'cancel' dialog after 30 seconds

if( dlg.show() )
{
switch( dlg.buttonPushed )
{
case 1: // Anytime
var marker = new Marker( "Reminder" );
this.onCommonCreate( programme, knRecurringAnyTime );
break;
case 2: // Once
var marker = new Marker( "Reminder" );
this.onCommonCreate( programme, knRecurringOnce );
break;
case 3: // Daily
var marker = new Marker( "Reminder" );
this.onCommonCreate( programme, knRecurringDaily );
break;
case 4: // Weekly
var marker = new Marker( "Reminder" );
this.onCommonCreate( programme, knRecurringWeekly );
break;
}
}


See Also

  • alert
  • prompt


    Requirements

    1111