Beeping while selecting text in a wxTextCtrl control
Posted: Sat Oct 02, 2010 8:15 pm
Hi,
I wrote a wxEVT_KEY_DOWN event handler for the wxTextCtrl control. The handler checks whether user pressed Ctrl+A and if he did - it selects the whole text in the wxTextCtrl.
Here's my handler:
The only thing which annoys me is the beeping while pressing the above combination.
I read about accelerators. According to docs:
and yes - the beeping doesn't occur any more. But now, my handler isn't being called when I press Ctrl+A
Do you know why is that Accelerators aren't well described in the documentation...
I wrote a wxEVT_KEY_DOWN event handler for the wxTextCtrl control. The handler checks whether user pressed Ctrl+A and if he did - it selects the whole text in the wxTextCtrl.
Here's my handler:
Code: Select all
void MyProgFrame::OnButtonPress(wxKeyEvent& event)
{
if( (event.GetModifiers() == wxMOD_CONTROL) && (event.GetUnicodeKey() == wxT('A')) )
{
TextCtrl1->SetSelection(-1, -1);
}
event.Skip();
}
I read about accelerators. According to docs:
So I added this code to my program:For example, you can use an accelerator table to enable a dialog with a multi-line text control to accept CTRL-Enter as meaning 'OK'
Code: Select all
wxAcceleratorEntry entry(wxACCEL_CTRL, (int)'A', ID_TEXTCTRL1);
wxAcceleratorTable table(1, &entry);
SetAcceleratorTable(table);
Do you know why is that Accelerators aren't well described in the documentation...