Ok,
I want execute my code, if the user writes a char in the WxComboBox.
I have created a new function with Events->OnTextEnter in the Form designer and wrote my code in the new function.
If I execute my programm, there happens nothing, if I enter sth. in the ComboBox.
My code works, if I set wxTE_PROCESS_ENTER to true and press enter.
But I don't want to press Enter... the function shall be startet, if I enter some text.
How can I start my function using OnTextEnter?!
Thank you very much!
WxComboBox OnTextEnter doesn't work
Re: WxComboBox OnTextEnter doesn't work
I think you're handling the wrong event type.
You probably need wxEVT_COMMAND_TEXT_UPDATED.
You probably need wxEVT_COMMAND_TEXT_UPDATED.
Re: WxComboBox OnTextEnter doesn't work
I added your code here:
But the compiler says:
Code: Select all
////Event Table Start
BEGIN_EVENT_TABLE(anmeldung_erfassenFrm,wxFrame)
////Manual Code Start
wxEVT_COMMAND_TEXT_UPDATED(ID_WXCOMBOBOX1,anmeldung_erfassenFrm::WxComboBox1TextEnter0)
////Manual Code End
EVT_CLOSE(anmeldung_erfassenFrm::OnClose)
Code: Select all
44 X:\Kursplaner\anmeldung_erfassenFrm.cpp `wxEVT_COMMAND_TEXT_UPDATED' cannot be used as a function
47 X:\Kursplaner\anmeldung_erfassenFrm.cpp expected `}' before "wxEventTableEntry"
47 X:\Kursplaner\anmeldung_erfassenFrm.cpp expected `,' or `;' before "wxEventTableEntry"
70 X:\Kursplaner\anmeldung_erfassenFrm.cpp expected declaration before '}' token
Re: WxComboBox OnTextEnter doesn't work
Uhm.. in your initial post you mentioned wxTE_PROCESS_ENTER which is an event type.
If you want to use the event table you need to use a macro corresponding to the event type; remember "the macro" != "the event type".
The macro corresponding to wxEVT_COMMAND_TEXT_UPDATED is EVT_TEXT.
If you want to use the event table you need to use a macro corresponding to the event type; remember "the macro" != "the event type".
The macro corresponding to wxEVT_COMMAND_TEXT_UPDATED is EVT_TEXT.
Re: WxComboBox OnTextEnter doesn't work
Thank you. Now the funktion is called, when the user type some text in.
But the text, I typed in, disappeares.
Must I get the text every time and then "->SetValue();" or is there any other option that my text doesn't become deleted?
Code: Select all
////Event Table Start
BEGIN_EVENT_TABLE(anmeldung_erfassenFrm,wxFrame)
////Manual Code Start
EVT_TEXT(ID_WXCOMBOBOX1,anmeldung_erfassenFrm::WxComboBox1TextEnter0)
////Manual Code End
But the text, I typed in, disappeares.
Must I get the text every time and then "->SetValue();" or is there any other option that my text doesn't become deleted?
Re: WxComboBox OnTextEnter doesn't work
You're asking what your code does but you're not showing any of it...
You probably need to add event.Skip(). Check the docs for its purpose.
You probably need to add event.Skip(). Check the docs for its purpose.
Re: WxComboBox OnTextEnter doesn't work
Ok, here is my code of the function, that is called when the user writes into the ComboBox:
I solved the problem that the text disappeared, if you type in sth.
Not the best way, but it works:
I need to open the "ListBox" in the ComboBox.
Since WxWidgets 2.9.1 the is the option "->Popup();"
http://docs.wxwidgets.org/2.9.2/classwx_combo_box.html
But with the wxDevC++ 7.3.1.3 it seems that I have not the latest wxWidgets.
Is there any way to update them simply?
I only found a download for MSW installation: http://sourceforge.net/projects/wxwindows/files/2.9.2/
I installed the package in a folder, and wanted to update the "combobox.h" files only... but the compiler still don't know "->Popup();"
I solved the problem that the text disappeared, if you type in sth.
Not the best way, but it works:
Code: Select all
WxComboBox1 = new wxComboBox(WxPanel1, ID_WXCOMBOBOX1, wxT(""), wxPoint(55, 200), wxSize(585, 23), arrayStringFor_WxComboBox1, 0, wxDefaultValidator, wxT("WxComboBox1"));
Code: Select all
/*
* WxComboBox1TextEnter0
*/
void anmeldung_erfassenFrm::WxComboBox1TextEnter0(wxCommandEvent& event)
{
// In Suchfeld eingegebenen Name erfassen:
wxString suchstring = WxComboBox1->GetLabel();
// Name in Datenbank suchen
sqlite3* Datenbank;
if(sqlite3_open("kursplaner.sqlite3", &Datenbank) != SQLITE_OK)
{
popup(1);
}
else
{
char **ergebnis=NULL;
int zeilen;
int spalten;
char *popup=NULL;
wxString get_command = "SELECT id, name, geburtstag FROM patienten WHERE name LIKE '"+ suchstring +"%'";
sqlite3_get_table(Datenbank, get_command, &ergebnis, &zeilen, &spalten, &popup);
WxComboBox1->Clear();
wxString temp_anzeige;
if(zeilen==0)
{
wxMessageBox("Keine Datensätze gefunden","Kursplaner",wxOK);
}
else
{
for(int i=3; i<=zeilen*3; i+=3)
{
temp_anzeige="";
temp_anzeige << ergebnis[i] << " | " << ergebnis[i+1] << " | " << ergebnis[i+2];
WxComboBox1->Append(temp_anzeige);
}
}
WxComboBox1->SetValue(suchstring);
WxComboBox1->SetInsertionPointEnd();
}
sqlite3_close(Datenbank);
}
I need to open the "ListBox" in the ComboBox.
Since WxWidgets 2.9.1 the is the option "->Popup();"
http://docs.wxwidgets.org/2.9.2/classwx_combo_box.html
But with the wxDevC++ 7.3.1.3 it seems that I have not the latest wxWidgets.
Is there any way to update them simply?
I only found a download for MSW installation: http://sourceforge.net/projects/wxwindows/files/2.9.2/
I installed the package in a folder, and wanted to update the "combobox.h" files only... but the compiler still don't know "->Popup();"
Re: WxComboBox OnTextEnter doesn't work
I couln't update WxWidgets sucessfully yet.
Is there any tutorial for updating the WxWidgets in wxDev-C++ ?
Is there any tutorial for updating the WxWidgets in wxDev-C++ ?