Bound wxEVT_TEXT_ENTER not called in 3.1.1

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
djmig
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Feb 10, 2016 11:18 pm

Bound wxEVT_TEXT_ENTER not called in 3.1.1

Post by djmig »

Hi, noob here.
A while back, I made a simple app using wxWidgets 3.1.0 where a wxTextCtrl has wxTE_PROCESS_ENTER property and a wxIntegerValidator, and it worked. Recompiling in 3.1.1, bound function to wxEVT_TEXT_ENTER in the same app never gets called. Is it a regression?

Code: Select all

#include <wx/wx.h>
#include <wx/string.h>
#include <wx/valnum.h>

#include "MyFrame.h"

MyFrame::MyFrame(wxFrame *frame)
	: wxPanel(frame, wxID_ANY, wxDefaultPosition, wxSize(MYWIDTH, MYHEIGHT))
{
	wxIntegerValidator<unsigned short> valid(&value);
	valid.SetRange(0, 10);

	tCtrl = new wxTextCtrl(this, ID_MYTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, valid);
	Bind(wxEVT_CLOSE_WINDOW, &MyFrame::OnCloseWindow, this, -1);
	Bind(wxEVT_PAINT, &MyFrame::OnPaint, this, -1);
	Bind(wxEVT_TEXT_ENTER, &MyFrame::OnTCtrlEnter, this);

}

void
MyFrame::OnTCtrlEnter(wxCommandEvent &event)
{
	// Does NOT get called ****
}

Code: Select all

#define MYWIDTH 400
#define MYHEIGHT 32
#define ID_MYTEXT 1

class MyFrame : public wxPanel
{
public:
	MyFrame(wxFrame *);
	~MyFrame();
	void OnCloseWindow(wxCloseEvent &);
	void OnPaint(wxPaintEvent &);
	void OnTCtrlEnter(wxCommandEvent &);

protected:
	unsigned short value;
	wxTextCtrl *tCtrl;
	...
};
Your help would be much appreciated. Thanks
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Bound wxEVT_TEXT_ENTER not called in 3.1.1

Post by ONEEYEMAN »

Hi,
Which OS you are testing it under?
Can you run the text sample and see if the event gets called there?

Thank you.
djmig
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Feb 10, 2016 11:18 pm

Re: Bound wxEVT_TEXT_ENTER not called in 3.1.1

Post by djmig »

Hi @ONEEYEMAN

I'm on OSX 10.11 (El Capitan).
It is reproducible in text sample, specifically in “Single line” text control. Found different behaviour. In 3.1.0, while logging text events, we can see "Enter pressed in some control" shown in the log window. In 3.1.1 it does not show the text.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Bound wxEVT_TEXT_ENTER not called in 3.1.1

Post by doublemax »

Should be fixed in latest version from GIT (or wait for new 3.1.2 allegedly coming next week).
https://trac.wxwidgets.org/ticket/18101
Use the source, Luke!
djmig
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Feb 10, 2016 11:18 pm

Re: Bound wxEVT_TEXT_ENTER not called in 3.1.1

Post by djmig »

Thanks @doublemax, I'll patch my copy of textctrl.mm
Post Reply