本文整理汇总了C++中wxTextCtrl::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTextCtrl::SetValue方法的具体用法?C++ wxTextCtrl::SetValue怎么用?C++ wxTextCtrl::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTextCtrl
的用法示例。
在下文中一共展示了wxTextCtrl::SetValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: OnStateChanged
void MyFrame::OnStateChanged(wxWebKitStateChangedEvent& myEvent)
{
if (GetStatusBar() != NULL)
{
if (myEvent.GetState() == wxWEBKIT_STATE_NEGOTIATING)
{
GetStatusBar()->SetStatusText(_("Contacting ") + myEvent.GetURL());
urlText->SetValue(myEvent.GetURL());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_TRANSFERRING)
{
GetStatusBar()->SetStatusText(_("Loading ") + myEvent.GetURL());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_STOP)
{
GetStatusBar()->SetStatusText(_("Load complete."));
SetTitle(mySafari->GetTitle());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_FAILED)
{
GetStatusBar()->SetStatusText(_("Failed to load ") + myEvent.GetURL());
}
}
}
示例3: OnDaytime
void MyFrame::OnDaytime(wxCommandEvent& event)
{
try
{
boost::asio::io_context io_context;
udp::resolver resolver(io_context);
udp::endpoint receiver_endpoint(udp::v4(), GetPort());
udp::socket socket(io_context);
socket.open(udp::v4());
boost::array<char, 1> send_buf = {{0}};
socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);
boost::array<char, 128> recv_buf;
memset(recv_buf.data(), 0, recv_buf.size());
udp::endpoint sender_endpoint;
size_t len = socket.receive_from(boost::asio::buffer(recv_buf), sender_endpoint);
m_daytime->SetValue(recv_buf.data());
// std::cout.write(recv_buf.data(), len);
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
示例4: 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"));
}
}
示例5: OnChooseFile
void PrivateImportDailyFrame::OnChooseFile(wxCommandEvent& ev)
{
wxFileDialog fileDialog( NULL, _("Open database"), wxEmptyString,
wxEmptyString,
_("History files (*.csv)|*.csv|All files (*.*)|*.*"),
wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if (fileDialog.ShowModal() == wxID_OK)
{
//SingleStockDB::Instance().ImportDailyQuotes(_T("ADSK"), fileDialog.GetPath());
file_path_input->SetValue(fileDialog.GetPath());
}
}
示例6: 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();
}
示例7: 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();
}
}
示例8: UpdateState
/**
* Method that retrieves the current state from the web control and updates the GUI
* the reflect this current state.
*/
void WebFrame::UpdateState()
{
m_toolbar->EnableTool( m_toolbar_back->GetId(), m_browser->CanGoBack() );
m_toolbar->EnableTool( m_toolbar_forward->GetId(), m_browser->CanGoForward() );
if (m_browser->IsBusy())
{
m_toolbar->EnableTool( m_toolbar_stop->GetId(), true );
}
else
{
m_toolbar->EnableTool( m_toolbar_stop->GetId(), false );
}
SetTitle( m_browser->GetCurrentTitle() );
m_url->SetValue( m_browser->GetCurrentURL() );
}
示例9: file
SLADECrashDialog(SLADEStackTrace& st) : wxDialog(wxTheApp->GetTopWindow(), -1, "SLADE3 Application Crash")
{
// Setup sizer
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(sizer);
// Add general crash method
string message = "SLADE3 has crashed unexpectedly. To help fix the problem that caused this crash,\nplease copy+paste the information from the window below to a text file, and email\nit to <[email protected]> along with a description of what you were\ndoing at the time of the crash. Sorry for the inconvenience.";
sizer->Add(new wxStaticText(this, -1, message), 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 4);
// Setup stack trace string
string trace = S_FMT("Version: %s\n", Global::version);
if (current_action.IsEmpty())
trace += "No current action\n";
else
trace += S_FMT("Current action: %s", current_action);
trace += "\n";
trace += st.getTraceString();
// Add stack trace text area
text_stack = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL);
text_stack->SetValue(trace);
text_stack->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
sizer->Add(text_stack, 1, wxEXPAND|wxALL, 4);
// Dump stack trace to a file (just in case)
wxFile file(appPath("slade3_crash.log", DIR_USER), wxFile::write);
file.Write(trace);
file.Close();
// Add standard 'OK' button
sizer->Add(CreateStdDialogButtonSizer(wxOK), 0, wxEXPAND|wxALL, 4);
// Setup layout
Layout();
SetInitialSize(wxSize(500, 500));
}
示例10: InitDialog
void DIALOG_LABEL_EDITOR::InitDialog()
{
wxString msg;
bool multiLine = false;
if( m_CurrentText->IsMultilineAllowed() )
{
m_textLabel = m_textLabelMultiLine;
m_textLabelSingleLine->Show( false );
multiLine = true;
}
else
{
m_textLabel = m_textLabelSingleLine;
m_textLabelMultiLine->Show( false );
wxTextValidator* validator = (wxTextValidator*) m_textLabel->GetValidator();
wxArrayString excludes;
// Add invalid label characters to this list.
excludes.Add( wxT( " " ) );
validator->SetExcludes( excludes );
}
m_textLabel->SetValue( m_CurrentText->GetText() );
m_textLabel->SetFocus();
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
SetTitle( _( "Global Label Properties" ) );
break;
case SCH_HIERARCHICAL_LABEL_T:
SetTitle( _( "Hierarchical Label Properties" ) );
break;
case SCH_LABEL_T:
SetTitle( _( "Label Properties" ) );
break;
case SCH_SHEET_PIN_T:
SetTitle( _( "Hierarchical Sheet Pin Properties." ) );
break;
default:
SetTitle( _( "Text Properties" ) );
break;
}
const int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
int max_len = 0;
if ( !multiLine )
{
max_len = m_CurrentText->GetText().Length();
}
else
{
// calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning
int curr_len = MINTEXTWIDTH;
int imax = m_CurrentText->GetText().Length();
for( int count = 0; count < imax; count++ )
{
if( m_CurrentText->GetText()[count] == '\n' ||
m_CurrentText->GetText()[count] == '\r' ) // new line
{
curr_len = 0;
}
else
{
curr_len++;
if ( max_len < curr_len )
max_len = curr_len;
}
}
}
if( max_len < MINTEXTWIDTH )
max_len = MINTEXTWIDTH;
wxString textWidth;
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
// Set validators
m_TextOrient->SetSelection( m_CurrentText->GetOrientation() );
m_TextShape->SetSelection( m_CurrentText->GetShape() );
int style = 0;
if( m_CurrentText->IsItalic() )
style = 1;
if( m_CurrentText->IsBold() )
style += 2;
//.........这里部分代码省略.........
示例11: UpdateTextWithoutEvent
void UpdateTextWithoutEvent()
{
m_text->SetValue(m_time.Format(m_useAMPM ? "%I:%M:%S %p" : "%H:%M:%S"));
HighlightCurrentField();
}
示例12: InitDialog
void DIALOG_LABEL_EDITOR::InitDialog()
{
wxString msg;
bool multiLine = false;
if( m_CurrentText->m_MultilineAllowed )
{
m_textLabel = m_textLabelMultiLine;
m_textLabelSingleLine->Show(false);
multiLine = true;
}
else
{
m_textLabel = m_textLabelSingleLine;
m_textLabelMultiLine->Show(false);
}
m_textLabel->SetValue( m_CurrentText->m_Text );
m_textLabel->SetFocus();
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
SetTitle( _( "Global Label Properties" ) );
break;
case SCH_HIERARCHICAL_LABEL_T:
SetTitle( _( "Hierarchical Label Properties" ) );
break;
case SCH_LABEL_T:
SetTitle( _( "Label Properties" ) );
break;
case SCH_SHEET_PIN_T:
SetTitle( _( "Hierarchical Sheet Pin Properties." ) );
break;
default:
SetTitle( _( "Text Properties" ) );
m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler ( DIALOG_LABEL_EDITOR::OnEnterKey ),
NULL, this );
break;
}
int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
int max_len = 0;
if ( !multiLine )
{
max_len =m_CurrentText->m_Text.Length();
}
else
{
// calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning
int curr_len = MINTEXTWIDTH;
int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ )
{
if( m_CurrentText->m_Text[count] == '\n' ||
m_CurrentText->m_Text[count] == '\r' ) // new line
{
curr_len = 0;
}
else
{
curr_len++;
if ( max_len < curr_len )
max_len = curr_len;
}
}
}
if( max_len < MINTEXTWIDTH )
max_len = MINTEXTWIDTH;
wxString textWidth;
textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
// Set validators
m_TextOrient->SetSelection( m_CurrentText->GetOrientation() );
m_TextShape->SetSelection( m_CurrentText->GetShape() );
int style = 0;
if( m_CurrentText->m_Italic )
style = 1;
if( m_CurrentText->m_Bold )
style += 2;
m_TextStyle->SetSelection( style );
wxString units = ReturnUnitSymbol( g_UserUnit, wxT( "(%s)" ) );
//.........这里部分代码省略.........
示例13: PutValueInLocalUnits
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
{
wxString msg = StringFromValue( g_UserUnit, aValue );
aTextCtr.SetValue( msg );
}
示例14: OnVarGet
void FlashFrame::OnVarGet(wxCommandEvent& WXUNUSED(event))
{
m_varvalue->SetValue(bstr2wx(
m_flash->GetVariable(wx2bstr(m_varname->GetValue()))));
}