Ask Your Question

How do I catch the return key being pressed when a user has entered text in a textbox?

asked 2017-10-05 23:04:30 +0100

Martyn gravatar image

LibreOffice Basic and Writer: I've designed a form with a textbox, I want the user to be able to type some text then press return, which my macro should then catch and add in to a listbox. At the moment I can type text but nothing happens when you press return... is there some event I can use, or am I missing something very obvious? Any suggestions to help a newbie would be gratefully appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-10-05 23:36:00 +0100

Ratslinger gravatar image

updated 2017-10-05 23:41:34 +0100


You can check for various characters using a macro attached to an Event for the text box. Your request can be done attached to Key pressed or Key released event. Events are obtained by right clicking the text box while in edit mode and selecting Control. They are on Events tab. A sample macro for this can be found in my answer on this post.

edit flag offensive delete link more


Thanks so much :)

Martyn gravatar imageMartyn ( 2017-10-06 17:26:04 +0100 )edit

If this answers your question please click on the ✔ (upper left area of answer).

Ratslinger gravatar imageRatslinger ( 2017-10-06 21:14:33 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-05 23:04:30 +0100

Seen: 31 times

Last updated: Oct 05 '17