WLJS LogoWLJS Notebook

ChoiceDialog

Wolfram Kernel
ChoiceDialog[expr_]

puts up a standard choice dialog that displays expr together with two buttons OK and CANCEL. It block the execution, until any button is pressed (or ESC / ENTER)

ChoiceDialog[expr_, {label1_ -> value1_, label2_ -> value2_ ...}]

includes buttons with labels labeli and returns valuei if clicked. Labels and values can be any WL expressions.

Blocking function. Avoid using it in timers like SetTimeout, external event handlers such as InputButton or Button, or within AsyncFunction. Use ChoiceDialogAsync instead

It will use StandardForm for displaying expressions

Examples

Confirm action

ChoiceDialog["Ok or not Ok?"]

Choose from the list of expressions

ChoiceDialog["Choose the Date", {Now->Now, Now + Quantity[1, "Days"] -> Now + Quantity[1, "Days"]}]

Choose from the list of labels

ChoiceDialog["Choose the Date", {"Now"->Now, "Tomorrow" -> Now + Quantity[1, "Days"]}]

Options

In a case of a lost context provide

"Notebook"

Specify explicitly a notebook where to pop up a window

On this page