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

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.

Hello,

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.

Thanks so much :slight_smile:

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