wxTE_PROCESS_ENTER handled too many times (over 1) Topic is solved

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
Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

wxTE_PROCESS_ENTER handled too many times (over 1)

Post by Tapsa » Tue Dec 17, 2013 4:31 pm

I am using 3.0.0 and I've noticed that whenever I press enter in a wxTextCtrl that does not have wxTE_PROCESS_ENTER property set, the event (enter press) gets handled in my own completely unrelated handler which has nothing to do with the correct event handler. The proper handler probably handles it, but due to 3.0.0 needing Event.Skip() in every wxFocusEvent handler, the event proceeds further. Who knows where it secretly goes before dying off. Sometimes the focus cursor gets trapped inside wxTextCtrl which has wxTE_PROCESS_ENTER.

What could possibly cause this?

User avatar
doublemax
Moderator
Moderator
Posts: 15068
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTE_PROCESS_ENTER handled too many times (over 1)

Post by doublemax » Tue Dec 17, 2013 7:32 pm

It sounds like a bug, but your description is a little confusing, so it's hard to say. We'll probably need a minimal sample that shows the problem.
Use the source, Luke!

Tapsa
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: wxTE_PROCESS_ENTER handled too many times (over 1)

Post by Tapsa » Wed Dec 18, 2013 1:55 pm

Could it be that I am using enum when connecting event handlers to events?

Code: Select all

enum
{
	MenuOption_Prompt,
	MenuOption_IDFix,
	MenuOption_Buttons,
	MenuOption_Tips,
	MenuOption_About,
	ToolBar_Open,
	ToolBar_Save,
	ToolBar_Show,
	ToolBar_Help
};

Code: Select all

Connect(MenuOption_IDFix, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(AGE_Frame::OnMenuOption));

Code: Select all

void AGE_Frame::OnMenuOption(wxCommandEvent &Event)
{
	switch(Event.GetId())
	{
	...
Note that this code used to work in wxWidgets 2.8.12 but does not in 3.0.0.

User avatar
doublemax
Moderator
Moderator
Posts: 15068
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTE_PROCESS_ENTER handled too many times (over 1)

Post by doublemax » Wed Dec 18, 2013 3:13 pm

Could it be that I am using enum when connecting event handlers to events?
I don't know if this is the cause for your problem, but it's definitely a bad idea. Your own identifiers should be higher than wxID_HIGHEST.

Code: Select all

enum
{
   MenuOption_Prompt = wxID_HIGHEST+1,
   MenuOption_IDFix,
   MenuOption_Buttons,
...
Use the source, Luke!

Post Reply