How to simulate a doneListener on textarea or textfield?

16 views
Skip to first unread message

Rocotoco Rodriguez

unread,
Jul 16, 2017, 8:41:10 AM7/16/17
to CodenameOne Discussions
HI!

im tryng to set into a textarea (3 rows ) a done listener to fire an action when done is pressed.

At the begining my control was a textarea because i need that the text accomodate himself to the control. because TextArea has not the  donelistener a i cant get that functionality

second i pass to TextField but when i set the setSingleLineTextArea(false) the done listener doesnt fires because the "Enter" key adds a line and not fires the listener.

what can i do?

thanks


If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Shai Almog

unread,
Jul 17, 2017, 12:10:02 AM7/17/17
to CodenameOne Discussions
Hi,
done listener is a feature of text fields only since it relies on the single line behavior. We wouldn't know when to fire it in multiline mode.

Shai Almog

unread,
Jul 17, 2017, 12:12:26 AM7/17/17
to CodenameOne Discussions
Just verifying, you are aware that action listener should work fine for most of these cases right?

Rocotoco Rodriguez

unread,
Jul 17, 2017, 4:29:39 PM7/17/17
to CodenameOne Discussions
shai:  i want to write many lines of text and fire the event when the user press ENTER or DONE.  the carriagereturn should works like SEND

Shai Almog

unread,
Jul 18, 2017, 12:18:55 AM7/18/17
to CodenameOne Discussions
That's problematic. You can try and use data change listener on a multiline text field and detect \n characters.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages