I have a modal window that asks user for text input using Text Edit Box.
For better user experience I'd like to make it so that when user hits Enter after typing in the input, it would be the same as user clicking OK button. Is there a way to do this?
win = New Window( "Text window",
<<Modal,
<<Return Result,
Text Box( "Type in your input" ),
textbox = Text Edit Box( <<Set script(/*Some script here to hit OK button when Enter is pressed */) ),
Button Box( "OK" ),
Button Box( "Cancel" )
);
I got this one!
win = New Window( "Text window",
<<Modal,
<<Return Result,
Text Box( "Type in your input" ),
textbox = Text Edit Box( <<Set script(okbutton << Click()) ),
okbutton = Button Box( "OK" ),
Button Box( "Cancel" )
);
You could use something like
<<Set Function(Function({this}, (this << sib) << Click()))
but do note that this will also trigger if user clicks outside the text edit box.
Names Default To Here(1);
win = New Window("Text window",
<<Modal,
<<Return Result,
Text Box("Type in your input"),
textbox = Text Edit Box("", << Set Function(function({this},
(this << sib) << Click()
))),
Button Box("OK"),
Button Box("Cancel")
);
I got this one!
win = New Window( "Text window",
<<Modal,
<<Return Result,
Text Box( "Type in your input" ),
textbox = Text Edit Box( <<Set script(okbutton << Click()) ),
okbutton = Button Box( "OK" ),
Button Box( "Cancel" )
);
You could use something like
<<Set Function(Function({this}, (this << sib) << Click()))
but do note that this will also trigger if user clicks outside the text edit box.
Names Default To Here(1);
win = New Window("Text window",
<<Modal,
<<Return Result,
Text Box("Type in your input"),
textbox = Text Edit Box("", << Set Function(function({this},
(this << sib) << Click()
))),
Button Box("OK"),
Button Box("Cancel")
);