BCS c++ Single And Multiple Line Data Entry


I developed a function that allows for single and multiple line data entry. Additionally the initial value, dialog prompt and caption may be specified. The function returns a single or multiple lines of text.
[codesyntax lang=”cpp”]

string MyFrame::GetText(bool memo, string initVal, string prompt, // @suppress("Type cannot be resolved")
		string caption) { // @suppress("Type cannot be resolved")
	wxString wxInit;
	wxInit = initVal;
	string rval; // @suppress("Type cannot be resolved")
	if (memo) {
		wxTextEntryDialog dlg( // @suppress("Type cannot be resolved")
				// @suppress("Type cannot be resolved")
				// @suppress("Type cannot be resolved")
				this, prompt, caption, wxInit,
				(wxCANCEL | wxOK | wxTE_MULTILINE), wxPoint(50, 50)); // @suppress("Symbol is not resolved")
		if (dlg.ShowModal() == wxID_OK) { // @suppress("Method cannot be resolved")
			// We can be certain that this string contains letters only.
			wxString value = dlg.GetValue(); // @suppress("Method cannot be resolved")
			rval = value;
			return rval;
		} else {
			rval = "";
			return rval;
		}
	} else {
		wxTextEntryDialog dlg(this, prompt, // @suppress("Type cannot be resolved")
				caption, wxInit, (wxCANCEL | wxOK), wxPoint(50, 50));
		if (dlg.ShowModal() == wxID_OK) { // @suppress("Method cannot be resolved")
			// We can be certain that this string contains letters only.
			wxString value = dlg.GetValue(); // @suppress("Method cannot be resolved")
			rval = value;
			return rval;
		} else {
			rval = "";
			return rval;
		}
	}
}

[/codesyntax]
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *