Author Topic: EVT_CHAR inside a plugin  (Read 5367 times)

Offline e.p

  • Multiple posting newcomer
  • *
  • Posts: 12
EVT_CHAR inside a plugin
« on: May 05, 2011, 04:55:52 pm »
Hello!

I am writing a plugin. Inside this plugin is a wxPanel with a wxTextCtrl set to read-only.
I need to get the characters typed into the TextCtrl (and not shown because of the read-only flag).
I implemented it with EVT_KEY_UP and it works... almost.
I need EVT_CHAR in order to get the correct case and symbols like +"*รง%&/(.

The problem: neither EVT_CHAR nor EVT_KEY_DOWN are fired when I type something in the TextCtrl.

I suppose, that somewhere a key-down-event is processed without Skip().

Is this a wanted feature of CB?
Ideas & suggestions are welcome :-)

Regards
e.p

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: EVT_CHAR inside a plugin
« Reply #1 on: May 05, 2011, 05:56:00 pm »
Probably you need to add wxWANTS_CHARS to the styles of the windows.
Search wxWidget's docs about more info.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline e.p

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: EVT_CHAR inside a plugin
« Reply #2 on: May 09, 2011, 11:45:18 am »
I added this options, but it still does not work...

If I add a button and I define the event handler for this button as follows:
Code
void myClass::OnButton(wxCommandEvent& event)
{
    wxKeyEvent kev(EVT_CHAR);
    wxPostEvent(this, kev);
}

Then, by clicking on the button, I can fire the event handler for EVT_CHAR
So the handler would process the event... if it would get it.

Does anyone know why this event gets lost or not generated?
Any idea on how to find out, if the event gets generated?

Thank you
e.p

Offline e.p

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: EVT_CHAR inside a plugin
« Reply #3 on: May 09, 2011, 12:13:11 pm »
SOLVED!

m_terminal is the instance of wxTextCtrl contained in myClass.

Code
m_terminal->Connect(id_terminal, wxEVT_CHAR, ...);

does exactly what I need :-)

Regards e.p