process enter key using wx_erlang (erlang port wxwidgets)

89 Views Asked by At

I am building a simple browser in erlang, using wx. This simple browser has a text box for entering a url. I want to execute a callback when the user presses the enter key while in the text box.

I can see several potential ways of doing this, one option would be to process each keypress event, and execute its default action unless it is an enter key, in which case the custom processing occurs.

I was hoping there might be a higher level event I could use, like control lost focus. I am new to wx, and do not mind if programmers using other tools comment as the question (at this stage) is more about using wx that a particular language binding.

1

There are 1 best solutions below

0
On

Not sure how is it called in wx_erlang, but there is wxEVT_TEXT_ENTER event to which you should bind. Note that you must create the control with wxTE_PROCESS_ENTER style to get this event.