SimpleWindow promptForChoice allow wrapping the prompt

This commit is contained in:
2023-08-14 15:09:37 -06:00
parent e70165a2e1
commit 94801ca00f

View File

@@ -655,7 +655,9 @@
null null
null null
enterKey enterKey
onDismiss)) onDismiss
false
true))
(function :SimpleWindow promptForChoice <>[T] [:String prompt (function :SimpleWindow promptForChoice <>[T] [:String prompt
:Array<T> choices :Array<T> choices
@@ -673,9 +675,12 @@
:String downKey :String downKey
:String enterKey :String enterKey
:ShortcutAction onClose :ShortcutAction onClose
:Bool noShortcuts] :Bool noShortcuts
(let [window (new SimpleWindow prompt bgColor titleColor percentWidth percentHeight xButton xKey leftKey rightKey upKey downKey enterKey onClose) :Bool wrapPrompt]
(let [window (new SimpleWindow (unless wrapPrompt prompt) bgColor titleColor percentWidth percentHeight xButton xKey leftKey rightKey upKey downKey enterKey onClose)
choiceColor (or choiceColor titleColor FlxColor.WHITE)] choiceColor (or choiceColor titleColor FlxColor.WHITE)]
(when wrapPrompt
(window.makeWrappedText prompt titleColor true))
(doFor choice choices (doFor choice choices
(window.makeText (Std.string choice) choiceColor (window.makeText (Std.string choice) choiceColor
(when (Std.string choice) (when (Std.string choice)