本文整理汇总了C++中wxTextCtrl::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTextCtrl::GetValue方法的具体用法?C++ wxTextCtrl::GetValue怎么用?C++ wxTextCtrl::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTextCtrl
的用法示例。
在下文中一共展示了wxTextCtrl::GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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"));
}
}
示例3: OnSolveButton
void MyFrame::OnSolveButton(wxCommandEvent& evt) {
Solver solver;
if(!solver.set_goal(goalEntry->GetValue().ToStdString())) {
wxMessageBox(wxT("Неверный формат целевой функции"),
wxT("Ошибка"), wxOK|wxCENTER|wxICON_ERROR);
return;
}
for(auto const& entry : restrEntries) {
bool restrSet = solver.add_restriction(entry->GetValue().ToStdString());
if(!restrSet) {
wxMessageBox(wxT("Неверный формат ограничения"),
wxT("Ошибка"), wxOK|wxCENTER|wxICON_ERROR);
return;
}
}
Solver invSolver = solver;
invSolver.invert_to_dual();
auto steps = solver.solve();
auto invSteps = invSolver.solve();
if(!steps.back().valid()) {
wxMessageBox(wxT("Неразрешимая система"),
wxT("Ошибка"), wxOK|wxCENTER|wxICON_ERROR);
return;
}
ClearNotebooks();
FillNotebook(steps, directStepsBook);
FillNotebook(invSteps, invertStepsBook);
}
示例4: TextPropertiesAccept
void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
{
wxString text;
int value;
/* save old text in undo list if not already in edit */
/* or the label to be edited is part of a block */
if( m_CurrentText->GetFlags() == 0 ||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
text = m_textLabel->GetValue();
if( !text.IsEmpty() )
m_CurrentText->m_Text = text;
else if( !m_CurrentText->IsNew() )
{
DisplayError( this, _( "Empty Text!" ) );
return;
}
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UserUnit, text );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape )
m_CurrentText->SetShape( m_TextShape->GetSelection() );
int style = m_TextStyle->GetSelection();
if( ( style & 1 ) )
m_CurrentText->m_Italic = 1;
else
m_CurrentText->m_Italic = 0;
if( ( style & 2 ) )
{
m_CurrentText->m_Bold = true;
m_CurrentText->m_Thickness = GetPenSizeForBold( m_CurrentText->m_Size.x );
}
else
{
m_CurrentText->m_Bold = false;
m_CurrentText->m_Thickness = 0;
}
m_Parent->OnModify();
/* Make the text size as new default size if it is a new text */
if( m_CurrentText->IsNew() )
m_Parent->SetDefaultLabelSize( m_CurrentText->m_Size.x );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->GetCanvas()->MoveCursorToCrossHair();
EndModal( wxID_OK );
}
示例5: 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();
});
//------------------------------------------------------------------------------
}
示例6: ValueFromTextCtrl
int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
{
int value;
wxString msg = aTextCtr.GetValue();
value = ValueFromString( g_UserUnit, msg );
return value;
}
示例7: TextPropertiesAccept
void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
{
wxString text;
int value;
/* save old text in undo list if not already in edit */
/* or the label to be edited is part of a block */
if( m_CurrentText->GetFlags() == 0 ||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
text = m_textLabel->GetValue();
if( !text.IsEmpty() )
m_CurrentText->SetText( text );
else if( !m_CurrentText->IsNew() )
{
DisplayError( this, _( "Empty Text!" ) );
return;
}
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue();
value = ValueFromString( g_UserUnit, text );
m_CurrentText->SetSize( wxSize( value, value ) );
if( m_TextShape )
/// @todo move cast to widget
m_CurrentText->SetShape( static_cast<PINSHEETLABEL_SHAPE>( m_TextShape->GetSelection() ) );
int style = m_TextStyle->GetSelection();
m_CurrentText->SetItalic( ( style & 1 ) );
if( ( style & 2 ) )
{
m_CurrentText->SetBold( true );
m_CurrentText->SetThickness( GetPenSizeForBold( m_CurrentText->GetSize().x ) );
}
else
{
m_CurrentText->SetBold( false );
m_CurrentText->SetThickness( 0 );
}
m_Parent->OnModify();
// Make the text size the new default size ( if it is a new text ):
if( m_CurrentText->IsNew() )
SetDefaultTextSize( m_CurrentText->GetSize().x );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->GetCanvas()->MoveCursorToCrossHair();
EndModal( wxID_OK );
}
示例8: OnOK
void PrivateImportDailyFrame::OnOK(wxCommandEvent& ev)
{
m_filename = file_path_input->GetValue().ToAscii();
m_symbol = symbol_input->GetValue().ToAscii();
//if (m_symbol.length() && m_filename.length())
// Show(false);
//else
Destroy();
//Destroy();
}
示例9: OnOK
void CDialogVolumeRename::OnOK(wxCommandEvent &e)
{
wxString sValue = m_pText->GetValue();
if(m_pVolumes->Rename(m_pThisVolume,sValue))
{
e.Skip(true);
}
else
{
mainApp::ShowError(m_pVolumes->GetLastError(),this);
}
}
示例10: getArgValue
// Get the value of the argument from the textbox
long getArgValue()
{
wxString val = text_control->GetValue();
// Empty string means ignore it
if (val == "")
return -1;
long ret;
val.ToLong(&ret);
return ret;
}
示例11: OnTextChanged
void DataExportDlg::OnTextChanged(wxCommandEvent&)
{
//if (!text->IsModified())
// return;
string s = wx2s(text->GetValue());
size_t colon = s.find(':');
bool parsable = (ftk->check_syntax("print " + s) && colon != string::npos);
FindWindow(wxID_OK)->Enable(parsable);
if (parsable) {
only_a_cb->SetValue(s.substr(0, colon) == "if a");
vector<string> v = split_string(s.substr(colon + 1), ',');
vm_foreach (string, i, v)
*i = strip_string(*i);
for (size_t i = 0; i < list->GetCount(); ++i)
list->Check(i, contains_element(v, wx2s(cv[i])));
}
}
示例12: 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);
}
示例13: validateNumberingTypeAndOffset
/**
* Validates and saves (if valid) the type and offset of an array axis numbering
*
* @param offsetEntry the entry of the offset (text)
* @param typeEntry the entry of the axis nmbering scheme (choice)
* @param type the destination of the type if valid
* @param offset the destination of the offset if valid
* @param errors error string accumulator
* @return if all valid
*/
static bool validateNumberingTypeAndOffset( const wxTextCtrl& offsetEntry,
const wxChoice& typeEntry,
DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T& type,
int& offset,
wxArrayString& errors )
{
const int typeVal = typeEntry.GetSelection();
// mind undefined casts to enums (should not be able to happen)
bool ok = typeVal <= DIALOG_CREATE_ARRAY::NUMBERING_TYPE_MAX;
if( ok )
{
type = (DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T) typeVal;
}
else
{
wxString err;
err.Printf( _("Unrecognised numbering scheme: %d"), typeVal );
errors.Add( err );
// we can't proceed - we don't know the numbering type
return false;
}
const wxString text = offsetEntry.GetValue();
ok = getNumberingOffset( text, type, offset );
if( !ok )
{
const wxString& alphabet = alphabetFromNumberingScheme( type );
wxString err;
err.Printf( _( "Could not determine numbering start from \"%s\": "
"expected value consistent with alphabet \"%s\"" ),
text, alphabet );
errors.Add(err);
}
return ok;
}
示例14: writeInfoPlistFile
void writeInfoPlistFile(wxTextFile& file)
{
if(not file.Exists()) {
wxMessageBox(_("Cannot access or create file!"));
return;
}
file.AddLine(wxT("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
file.AddLine(wxT("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" "
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"));
file.AddLine(wxT("<plist version=\"1.0\">"));
file.AddLine(wxT("<dict>\n"));
file.AddLine(wxT(" <key>CFBundleExecutable</key>"));
file.AddLine(wxT(" <string>") + m_project_name + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleGetInfoString</key>"));
file.AddLine(wxT(" <string>") + m_get_info_string->GetValue() + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleIconFile</key>"));
file.AddLine(wxT(" <string>") + m_icon_file->GetValue() + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleIdentifier</key>"));
file.AddLine(wxT(" <string>") + m_identifier->GetValue() + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleSignature</key>"));
file.AddLine(wxT(" <string>") + m_signature->GetValue() + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleVersion</key>"));
file.AddLine(wxT(" <string>") + m_version->GetValue() + wxT("</string>\n"));
file.AddLine(wxT(" <key>CFBundleInfoDictionaryVersion</key>"));
file.AddLine(wxT(" <string>6.0</string>\n"));
file.AddLine(wxT(" <key>CFBundleDevelopmentRegion</key>"));
file.AddLine(wxT(" <string>English</string>\n"));
file.AddLine(wxT(" <key>CFBundlePackageType</key>"));
file.AddLine(wxT(" <string>APPL</string>\n"));
file.AddLine(wxT(" <key>CFBundleShortVersionString</key>"));
file.AddLine(wxT(" <string>") + m_version->GetValue() + wxT("</string>\n"));
file.AddLine(wxT("</dict>"));
file.AddLine(wxT("</plist>"));
if(not file.Write()) {
wxMessageBox(_("Failed to write Info.plist file!"));
return;
}
}
示例15: getIconDestName
wxString getIconDestName() { return m_icon_file->GetValue(); }