本文整理汇总了C++中wxTextCtrl::SetBackgroundColour方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTextCtrl::SetBackgroundColour方法的具体用法?C++ wxTextCtrl::SetBackgroundColour怎么用?C++ wxTextCtrl::SetBackgroundColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTextCtrl
的用法示例。
在下文中一共展示了wxTextCtrl::SetBackgroundColour方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
});
//------------------------------------------------------------------------------
}
示例2: OnFindText
void WebFrame::OnFindText(wxCommandEvent& evt)
{
int flags = 0;
if(m_find_toolbar_wrap->IsChecked())
flags |= wxWEBVIEW_FIND_WRAP;
if(m_find_toolbar_wholeword->IsChecked())
flags |= wxWEBVIEW_FIND_ENTIRE_WORD;
if(m_find_toolbar_matchcase->IsChecked())
flags |= wxWEBVIEW_FIND_MATCH_CASE;
if(m_find_toolbar_highlight->IsChecked())
flags |= wxWEBVIEW_FIND_HIGHLIGHT_RESULT;
if(m_find_toolbar_previous->GetId() == evt.GetId())
flags |= wxWEBVIEW_FIND_BACKWARDS;
wxString find_text = m_find_ctrl->GetValue();
long count = m_browser->Find(find_text, flags);
if(m_findText != find_text)
{
m_findCount = count;
m_findText = find_text;
}
if(count != wxNOT_FOUND || find_text.IsEmpty())
{
m_find_ctrl->SetBackgroundColour(*wxWHITE);
}
else
{
m_find_ctrl->SetBackgroundColour(wxColour(255, 101, 101));
}
m_find_ctrl->Refresh();
//Log the result, note that count is zero indexed.
if(count != m_findCount)
{
count++;
}
wxLogMessage("Searching for:%s current match:%i/%i", m_findText.c_str(), count, m_findCount);
}
示例3: 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"));
}