2 つまたは 3 つの選択肢 (Option.YesNo または Option.YesNoCancel) に制限されないオプション ダイアログを作成しようとしましたが、これらの組み込みオプション以外を使用する方法を見つけることができませんでした。具体的には、次の例では、optionType に指定できるものをすべて受け入れることを拒否しています。
object Choices extends Enumeration {
type Choice = Value
val red, yellow, green, blue = Value
}
val options = List("Red", "Yellow", "Green", "Blue")
label.text = showOptions(null,
"What is your favorite color?",
"Color preference",
optionType = Choices.Value,
entries = options,
initial = 2) match {
case Choice.red => "Red"
case Choice.yellow => "Yellow"
case Choice.green => "Green"
case Choice.blue => "Blue"
case _ => "Some other color"
}