本文整理汇总了C++中wxTextCtrl类的典型用法代码示例。如果您正苦于以下问题:C++ wxTextCtrl类的具体用法?C++ wxTextCtrl怎么用?C++ wxTextCtrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxTextCtrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunConfigDialog
RunConfigDialog(wxWindow* parent, string title, string name, string params, bool custom = true) : wxDialog(parent, -1, title)
{
// Setup sizer
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(sizer);
wxGridBagSizer* gb_sizer = new wxGridBagSizer(8, 4);
sizer->Add(gb_sizer, 1, wxEXPAND|wxALL, 10);
// Config name
gb_sizer->Add(new wxStaticText(this, -1, "Config Name:"), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
text_name = new wxTextCtrl(this, -1, name);
text_name->Enable(custom);
gb_sizer->Add(text_name, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND);
// Config params
gb_sizer->Add(new wxStaticText(this, -1, "Parameters:"), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
text_params = new wxTextCtrl(this, -1, params);
gb_sizer->Add(text_params, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND);
wxStaticText* label_help = new wxStaticText(this, -1, "");
gb_sizer->Add(label_help, wxGBPosition(2, 0), wxGBSpan(1, 2), wxEXPAND);
gb_sizer->Add(CreateStdDialogButtonSizer(wxOK|wxCANCEL), wxGBPosition(3, 0), wxGBSpan(1, 2), wxALIGN_RIGHT);
gb_sizer->AddGrowableCol(1);
gb_sizer->AddGrowableRow(2);
label_help->SetLabel("%i - Base resource archive\n%r - Resource archive(s)\n%a - Current archive\n%mn - Map name\n%mw - Map number (eg. E1M1 = 1 1, MAP02 = 02)");
label_help->Wrap(300);
text_params->SetInsertionPoint(0);
}
示例2: write
//read messages from buffer and write them to the screen
void write(wxCommandEvent &)
{
if (messages.size() > 0)
{
messages.lockGet();
size_t size = messages.size();
std::vector<char> local_messages(size);
messages.popN(&local_messages.front(), size);
messages.unlockGet();
newLog = false;
u32 cursor = 0;
u32 removed = 0;
while (cursor < local_messages.size())
{
Log::LogMessage msg = Log::LogMessage::deserialize(local_messages.data() + cursor, &removed);
cursor += removed;
if (removed <= 0)
{
break;
}
wxTextCtrl *llogcon = (msg.mType == Log::TTY) ? m_tty : m_log;
if (llogcon)
{
switch (msg.mServerity)
{
case Log::LogSeverityNotice:
llogcon->SetDefaultStyle(m_color_white);
break;
case Log::LogSeverityWarning:
llogcon->SetDefaultStyle(m_color_yellow);
break;
case Log::LogSeverityError:
llogcon->SetDefaultStyle(m_color_red);
break;
case Log::LogSeveritySuccess:
llogcon->SetDefaultStyle(m_color_green);
break;
default:
break;
}
llogcon->AppendText(fmt::FromUTF8(msg.mText));
}
}
if (m_log->GetLastPosition() > GUI_BUFFER_MAX_SIZE)
{
m_log->Remove(0, m_log->GetLastPosition() - (GUI_BUFFER_MAX_SIZE/2));
}
}
}
示例3: setArgValue
// Set the value in the textbox
void setArgValue(long val)
{
if (val < 0)
text_control->ChangeValue("");
else
text_control->ChangeValue(S_FMT("%ld", val));
}
示例4: log
void log(agi::log::SinkMessage *sm) override {
#ifndef _WIN32
tm tmtime;
localtime_r(&sm->tv.tv_sec, &tmtime);
auto log = wxString::Format("%c %02d:%02d:%02d %-6ld <%-25s> [%s:%s:%d] %s\n",
agi::log::Severity_ID[sm->severity],
(int)tmtime.tm_hour,
(int)tmtime.tm_min,
(int)tmtime.tm_sec,
(long)sm->tv.tv_usec,
sm->section,
sm->file,
sm->func,
sm->line,
to_wx(sm->message));
#else
auto log = wxString::Format("%c %-6ld <%-25s> [%s:%s:%d] %s\n",
agi::log::Severity_ID[sm->severity],
sm->tv.tv_usec,
sm->section,
sm->file,
sm->func,
sm->line,
to_wx(sm->message));
#endif
if (wxIsMainThread())
text_ctrl->AppendText(log);
else
agi::dispatch::Main().Async([=]{ text_ctrl->AppendText(log); });
}
示例5: DoChangeFont
void MyFrame::DoChangeFont(const wxFont& font, const wxColour& col)
{
m_canvas->SetTextFont(font);
if ( col.IsOk() )
m_canvas->SetColour(col);
m_canvas->Refresh();
m_textctrl->SetFont(font);
if ( col.IsOk() )
m_textctrl->SetForegroundColour(col);
m_textctrl->Refresh();
// update the state of the bold/italic/underlined menu items
wxMenuBar *mbar = GetMenuBar();
if ( mbar )
{
mbar->Check(Font_Light, font.GetWeight() == wxFONTWEIGHT_LIGHT);
mbar->Check(Font_Bold, font.GetWeight() == wxFONTWEIGHT_BOLD);
mbar->Check(Font_Italic, font.GetStyle() == wxFONTSTYLE_ITALIC);
#ifndef __WXMSW__
mbar->Check(Font_Slant, font.GetStyle() == wxFONTSTYLE_SLANT);
#endif
mbar->Check(Font_Underlined, font.GetUnderlined());
mbar->Check(Font_Strikethrough, font.GetStrikethrough());
}
}
示例6: download_file
void wxMiniApp::download_file(wxString filename)
{
try
{
text = wxT("Downloading ") + filename + wxT("...");
status->AppendText(text);
WebForm http_connection;
http_connection.setHost(update_server.mb_str());
http_connection.setScriptFile(filename.mb_str());
http_connection.sendRequest();
wxString complete_path = wxT("");
complete_path += local_path;
complete_path += filename;
bool success = http_connection.downloadBigFile(complete_path.mb_str());
// Downloaded succesfully?
if(success)
{
// Yes :)
text = wxT(" Done");
status->AppendText(text);
status->AppendText(wxT("\n"));
}
else
{
// No :(
text = wxT(" Error");
status->AppendText(text);
status->AppendText(wxT("\n"));
}
} catch(WebFormException ex) { /*cout << ex.getMessage() << endl;*/ }
}
示例7: OnCalc
void MyFrame::OnCalc(wxCommandEvent& event)
{
std::string text = invoice_list->GetValue().ToStdString();
std::string target = target_input->GetValue().ToStdString();
Finder f = Finder();
int n;
Finder::readToInt(&n,target.c_str());
f.setTarget(n);
f.setValues(text);
f.make();
std::vector<int> result = f.getResult();
if (result.size() == 0) {
result_list->SetValue(L"拼凑失败!");
return;
}
double sum = 0;
std::stringstream result_str;
for (std::vector<int>::size_type i = 0; i != result.size(); ++i) {
double v = result[i] / 100.0;
result_str << v;
if (i != result.size() -1)
result_str << " + ";
sum += v;
}
result_str << " = ";
result_str << sum;
result_list->SetValue(result_str.str());
}
示例8: TransferDataFromWindow
virtual bool TransferDataFromWindow()
{
wxFileName fileName = m_filePicker->GetFileName();
if (fileName.FileExists())
{
alertDlg("Project file is already exist.\nSelect other filename.", this);
m_filePicker->SetFocus();
return false;
}
if (!fileName.IsOk())
{
alertDlg("Project file name is empty or invalid.", this);
m_filePicker->SetFocus();
return false;
}
if (m_textName->GetLabelText().IsEmpty())
{
alertDlg("Project name is empty.", this);
m_textName->SetFocus();
return false;
}
return true;
}
示例9: Execute
void DisplayProcess::Execute(const wxString& command)
{
if (!tctrl)
{
return;
}
wxProcess *process = new wxProcess(wxPROCESS_REDIRECT);
//long pid =
wxExecute(command, wxEXEC_ASYNC, process);
process->Redirect();
if (process)
{
wxString log;
wxInputStream *msg = process->GetInputStream();
wxTextInputStream tStream(*msg);
while (!msg->Eof())
{
log = tStream.ReadLine();
tctrl->AppendText(log + wxT("\n"));
tctrl->ShowPosition(tctrl->GetLastPosition());
}
tctrl->AppendText(wxT("Finished!\n"));
}
else {
tctrl->AppendText(wxT("FAIL: Command" + command + " could not be run!\n"));
}
}
示例10: 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);
}
示例11: HighlightCurrentField
// Select the currently actively field.
void HighlightCurrentField()
{
m_text->SetFocus();
const CharRange range = GetFieldRange(m_currentField);
m_text->SetSelection(range.from, range.to);
}
示例12: OnTestTextValue
void MyFrame::OnTestTextValue(wxCommandEvent& WXUNUSED(event))
{
wxString value = m_textctrl->GetValue();
m_textctrl->SetValue(value);
if ( m_textctrl->GetValue() != value )
{
wxLogError(wxT("Text value changed after getting and setting it"));
}
}
示例13: onPlistCheckboxPressed
void onPlistCheckboxPressed(wxCommandEvent& evt)
{
const bool on = m_info_plist_cb->IsChecked();
m_get_info_string->Enable(on);
m_version->Enable(on);
m_icon_file->Enable(on);
m_identifier->Enable(on);
m_signature->Enable(on);
}
示例14: Log
// Log messages to the text control
void MyFrame::Log(const wxString& text)
{
if (m_textCtrl)
{
wxString text2(text);
text2.Replace(wxT("\n"), wxT(" "));
text2.Replace(wxT("\r"), wxT(" "));
m_textCtrl->SetInsertionPointEnd();
m_textCtrl->WriteText(text2 + wxT("\n"));
}
}
示例15: OnFind
void WebFrame::OnFind(wxCommandEvent& WXUNUSED(evt))
{
wxString value = m_browser->GetSelectedText();
if(value.Len() > 150)
{
value.Truncate(150);
}
m_find_ctrl->SetValue(value);
if(!m_find_toolbar->IsShown()){
m_find_toolbar->Show(true);
SendSizeEvent();
}
m_find_ctrl->SelectAll();
}