Hello!
I'm using C::B 20.03 and wxWidgets 3.2.4. on Windows 10 (64 bit).
I have an example of wxsmith, see the link below.
https://wiki.codeblocks.org/index.php/WxSmith_tutorial:_Keyboard_Input_and_Displaying_Results
void Tutorial_9Frame::OnCmdBoxTextEnter(wxCommandEvent& event)
{
wxString textFCB = CmdBox->GetValue();
CmdBox->Insert(textFCB, 0);
CmdBox->SetValue(wxT(""));
if(CmdBox->GetCount() == 10)
CmdBox->Delete(9);
Results->AppendText(textFCB);
Results->AppendText(_("\n"));
strncpy(inbuf, (const char*) textFCB.mb_str(wxConvUTF8), 239);
// anything(); //We will be using this later.
}
The above code captures the ENTER event, but my program cannot run properly.
QuoteMy program cannot run properly
Please clarify what are you expecting and what is happening. Did you check wxTE_PROCESS_ENTER?
Looking at the picture below, I typed some letters and then pressed the Enter key, but the program didn't respond.
Can you attach your current cpp file?
Please see attach. Thank you!
You have not checked wxTE_PROCESS_ENTER in the combobox style (I asked you explicitly about this):
CmdBox = new wxComboBox(wxp1, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_COMBOBOX1"));should be
CmdBox = new wxComboBox(wxp1, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_COMBOBOX1"));Goto wxSmith and check it.
EDIT: extract fom the tutorial (https://wiki.codeblocks.org/index.php/WxSmith_tutorial:_Keyboard_Input_and_Displaying_Results#Getting_Input_from_the_User_and_Handling_the_Items_List_in_a_Combobox) you were following;
QuoteYou may notice that nothing happens when you press Enter in CmdBox. That is because we have to set CmdBox to handle that event. Select this control in Code::Blocks Resources window, then in Properties open Style section and check wxTE_PROCESS_ENTER. Now it's working as expected.
Thank you very much!