The return key does not work as expected in an InputField, how can I overcome this?
Answer
Ah, figured it out:
Panel @ DynamicModule[{input = ""},
Column[{TextCell["Enter your text here:"],
EventHandler[
InputField[Dynamic[input], String, ContinuousAction -> True,
FieldSize -> {40, 7}],
"ReturnKeyDown" :>
FrontEndExecute[{NotebookWrite[InputNotebook[], "\n", After]}]
], Dynamic@InputForm[input]}]]
Comments
Post a Comment