When using c++ wxWidgets a vehicle is needed that will return the contents of the field into a standard string. The following function accomplishes that task.
[codesyntax lang=”cpp”]
string MyFrame::fieldToString(wxTextCtrl * field) { // @suppress("Type cannot be resolved") string rstr; // @suppress("Type cannot be resolved") wxString s1 = field->GetValue(); // @suppress("Method cannot be resolved") rstr = s1.ToStdString(); // @suppress("Method cannot be resolved") return rstr; }
[/codesyntax]
This mechanism allows for easy retrieval and conversion of c++ wxWidgets fields.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.