本文整理汇总了C++中wxTextCtrl::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTextCtrl::Clear方法的具体用法?C++ wxTextCtrl::Clear怎么用?C++ wxTextCtrl::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTextCtrl
的用法示例。
在下文中一共展示了wxTextCtrl::Clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRun
void MyFrame::OnRun(wxCommandEvent &event) {
ostringstream stream;
text->Clear();
unique_ptr<eph::nominate_abstract> nsl;
switch (methods->GetCurrentSelection()) {
case 0:
nsl = make_unique<eph::nominate_pal>(stream, lines);
break;
case 1:
nsl = make_unique<eph::nominate_sdv_lpe>(stream, lines);
break;
case 2:
nsl = make_unique<eph::nominate_sdv_lpe>(stream, lines, eph::ENABLE_SL::YES);
break;
}
auto result = nsl->nominate(finalists->GetCurrentSelection()+1, noms_per_ballot->GetCurrentSelection()+1);
if (verbose->GetValue()) {
text->AppendText(stream.str());
}
text->AppendText(result);
}
示例2: MainFrame
MainFrame(const wxString& title) {
wxXmlResource::Get()->LoadFrame(this, NULL, "Frame1");
m_buttonFindAll = XRCCTRL(*this, "m_buttonFindAll", wxButton);
m_textCtrlRegex = XRCCTRL(*this, "m_textCtrlRegex", wxTextCtrl);
m_textCtrlString = XRCCTRL(*this, "m_textCtrlString", wxTextCtrl);
m_textCtrlFindAll = XRCCTRL(*this, "m_textCtrlFindAll", wxTextCtrl);
m_textCtrlRegex->Bind(wxEVT_TEXT, [=](wxCommandEvent &event){
std::wstring a = m_textCtrlRegex->GetValue();
auto R = re::compile(a);
if (R){
m_textCtrlRegex->SetBackgroundColour(wxColor(0,255,0));
m_textCtrlRegex->Refresh();
m_textCtrlFindAll->Clear();
m_textCtrlFindAll->Refresh();
}
else{
m_textCtrlRegex->SetBackgroundColour(wxColor(255, 0, 0));
m_textCtrlRegex->Refresh();
m_textCtrlFindAll->Clear();
m_textCtrlFindAll->AppendText(std::to_string(re::getlasterror()));
m_textCtrlFindAll->AppendText("\n");
m_textCtrlFindAll->AppendText(re::getlasterrorstr());
m_textCtrlFindAll->Refresh();
}
}
);
//------------------------------------------------------------------------------
m_buttonFindAll->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent &event){
m_textCtrlFindAll->Clear();
std::wstring a = m_textCtrlRegex->GetValue();
auto R = re::compile(a);
if (R){
std::wstring s = m_textCtrlString->GetValue();
auto v = R->findall(s);
for (auto i = v.begin(); i < v.end(); i++){
m_textCtrlFindAll->AppendText(*i);
m_textCtrlFindAll->AppendText("\n");
}
}
m_textCtrlFindAll->Refresh();
});
//------------------------------------------------------------------------------
}
示例3: OnWriteClipboardContents
void MyFrame::OnWriteClipboardContents(wxCommandEvent& WXUNUSED(event))
{
if (wxTheClipboard->Open())
{
if (wxTheClipboard->IsSupported( wxDF_UNICODETEXT ))
{
wxTextDataObject data;
wxTheClipboard->GetData( data );
m_textctrl->Clear();
m_textctrl->SetValue( data.GetText() );
}
wxTheClipboard->Close();
}
}
示例4: OnOpen
void MyFrame::OnOpen(wxCommandEvent & WXUNUSED(event)) {
wxFileDialog dialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (dialog.ShowModal() == wxID_OK) {
wxString filename(dialog.GetPath());
wxTextFile text_file(filename);
if (!text_file.Open(wxConvUTF8)) {
return;
}
grid->EnableEditing(false);
if (text_file.GetLineCount() > grid->GetNumberRows()) {
grid->AppendRows(text_file.GetLineCount() - grid->GetNumberRows());
} else if (text_file.GetLineCount() < grid->GetNumberRows()) {
grid->DeleteRows(text_file.GetLineCount(), grid->GetNumberRows() - text_file.GetLineCount());
}
grid->ClearGrid();
for (int row = 0; row < text_file.GetLineCount(); ++row) {
wxStringTokenizer tokenizer(text_file[row], L",");
for (int col = 0; tokenizer.HasMoreTokens() && col < grid->GetNumberCols(); ++col) {
wxString token = tokenizer.GetNextToken();
grid->SetCellValue(row, col, token);
}
}
grid->AutoSize();
text->Clear();
lines.clear();
for (int row = 0; row < text_file.GetLineCount(); ++row) {
lines.push_back(text_file[row]);
}
text_file.Close();
topsizer->Layout();
SetStatusText(wxFileName(filename).GetFullName());
}
}
示例5: show_preview
void OutputWinConfDlg::show_preview()
{
const wxColour& output = ow_->text_color_[UserInterface::kNormal];
const wxColour& input = ow_->text_color_[UserInterface::kInput];
const wxColour& quote = ow_->text_color_[UserInterface::kQuoted];
const wxColour& warning = ow_->text_color_[UserInterface::kWarning];
preview_->Clear();
preview_->SetBackgroundColour(ow_->bg_color_);
preview_->SetDefaultStyle(ow_->GetDefaultStyle());
preview_->SetDefaultStyle(wxTextAttr(output));
preview_->AppendText(wxT("\nsettings preview\n\n"));
preview_->SetDefaultStyle(wxTextAttr(input));
preview_->AppendText(wxT("=-> i pi\n"));
preview_->SetDefaultStyle(wxTextAttr(output));
preview_->AppendText(wxT("3.14159\n"));
preview_->SetDefaultStyle(wxTextAttr(input));
preview_->AppendText(wxT("=-> c < file.fit\n"));
preview_->SetDefaultStyle(wxTextAttr(quote));
preview_->AppendText(wxT("1> bleh in file\n"));
preview_->SetDefaultStyle(wxTextAttr(warning));
preview_->AppendText(wxT("Syntax error.\n"));
}
示例6: OnClear
void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event))
{
m_txtctrl->Clear();
}
示例7: OnClearLog
void MyFrame::OnClearLog( wxCommandEvent& WXUNUSED(event) )
{
m_log->Clear();
}
示例8: OnQuery
void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
{
m_textCtrl->Clear();
IAccessible* accessibleFrame = NULL;
if (S_OK != AccessibleObjectFromWindow((HWND) GetHWND(), OBJID_CLIENT,
IID_IAccessible, (void**) & accessibleFrame))
{
Log(wxT("Could not get object."));
return;
}
if (accessibleFrame)
{
//Log(wxT("Got an IAccessible for the frame."));
LogObject(0, accessibleFrame);
Log(wxT("Checking children using AccessibleChildren()..."));
// Now check the AccessibleChildren function works OK
long childCount = 0;
if (S_OK != accessibleFrame->get_accChildCount(& childCount))
{
Log(wxT("Could not get number of children."));
accessibleFrame->Release();
return;
}
else if (childCount == 0)
{
Log(wxT("No children."));
accessibleFrame->Release();
return;
}
long obtained = 0;
VARIANT *var = new VARIANT[childCount];
int i;
for (i = 0; i < childCount; i++)
{
VariantInit(& (var[i]));
var[i].vt = VT_DISPATCH;
}
if (S_OK == AccessibleChildren(accessibleFrame, 0, childCount, var, &obtained))
{
for (i = 0; i < childCount; i++)
{
IAccessible* childAccessible = NULL;
if (var[i].pdispVal)
{
if (var[i].pdispVal->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
{
var[i].pdispVal->Release();
wxString name, role;
GetInfo(childAccessible, 0, name, role);
wxString str;
str.Printf(wxT("Found child %s/%s"), name.c_str(), role.c_str());
Log(str);
childAccessible->Release();
}
else
{
var[i].pdispVal->Release();
}
}
}
}
else
{
Log(wxT("AccessibleChildren failed."));
}
delete[] var;
accessibleFrame->Release();
}
}