Dialog

Dialog class shows various dialogs, such as a message box, a file selection dialog.

Dialog.message(text[, icon[, button[, caption]]])

Shows a message box. You input a message into "text" and the following arguments can be specified as an option.

"icon" is an icon shown on a message dialog, and chooses it from one of following.

Dialog.MESSAGE

An icon is not shown.

Dialog.INFORMATION

Information(i)

Dialog.QUESTION

Question(?)

Dialog.WARNING

Warning(!)

Dialog.ERROR

Error(×)

"button" chooses one of following these for the type of the button to show.

Dialog.OK

[OK]

Dialog.OKCANCEL

[OK][Cancel]

Dialog.YESNO

[Yes][No]

Dialog.YESNOCANCEL

[Yes][No][Cancel]

Dialog.RETRYCANCEL

[Retry][Cancel]

Dialog.ABORTRETRYIGNORE

[Abort][Retry][Ignore]

"caption" is a text shown on a title bar.

You can know which button was pressed by the return value of a function. A return value is one of following.

Dialog.RESOK

[OK] button

Dialog.RESCANCEL

[Cancel] button

Dialog.RESABORT

[Abort] button

Dialog.RESRETRY

[Retry] button

Dialog.RESIGNORE

[Ignore] button

Dialog.RESYES

[Yes] button

Dialog.RESNO

[No] button

Dialog.input(message[, caption])

Shows a text input dialog. You specify the message shown on "message", and the text shown on "caption" at a title bar. A return value is the text inputted into the entry field. If canceled, it returns an empty string.

Input box

Dialog.select(message, items[, caption])

Shows the dialog for selecting one from multiple items. You specify the message shown in "message", a selection candidate's array in "items", and the text shown on a title bar in "caption". A return value is a number of the place of the selected item, and if canceled, it returns -1.

Selection box

Dialog.color([color])

Shows a color selection dialog. The color of initial status can be specified in "color" as HTML format*1. A return value is a text of HTML format.

Dialog.open([filename])

Shows the dialog "Open file". The file name shown first can be specified in "filename". A return value is a full path of the selected file, and if canceled, it return an empty string.

Dialog.save([filename])

Shows the dialog "Save file". The file name shown first can be specified in "filename". A return value is a full path of the selected file, and if canceled, it return an empty string.


*1 For example, "red", "#ddfe34".