Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: e.p on May 05, 2011, 04:55:52 pm

Title: EVT_CHAR inside a plugin
Post by: e.p 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
Title: Re: EVT_CHAR inside a plugin
Post by: oBFusCATed 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.
Title: Re: EVT_CHAR inside a plugin
Post by: e.p 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: [Select]
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
Title: Re: EVT_CHAR inside a plugin
Post by: e.p on May 09, 2011, 12:13:11 pm
SOLVED!

m_terminal is the instance of wxTextCtrl contained in myClass.

Code: [Select]
m_terminal->Connect(id_terminal, wxEVT_CHAR, ...);
does exactly what I need :-)

Regards e.p