void mmAssetsListCtrl::OnEndLabelEdit(wxListEvent& event) { if (event.IsEditCancelled()) return; Model_Asset::Data* asset = &m_panel->m_assets[event.GetIndex()]; asset->ASSETNAME = event.m_item.m_text; Model_Asset::instance().save(asset); RefreshItems(event.GetIndex(), event.GetIndex()); }
void MyListCtrl::OnEndLabelEdit(wxListEvent& event) { wxLogMessage( wxT("OnEndLabelEdit: %s"), ( event.IsEditCancelled() ? wxString("[cancelled]") : event.m_item.m_text ).c_str() ); }
void EditChainsDialog::OnChainsEndEdit(wxListEvent &event) { if (event.IsEditCancelled()) { return; } wxString newname = event.GetLabel(); mBatchCommands.RenameChain(mActiveChain, newname); mActiveChain = newname; PopulateChains(); }
void LineEditor::OnlvStopsEndLabelEdit(wxListEvent& event) { if(event.IsEditCancelled()) return; TimeOffset t; std::string s(event.GetText()); t.parse(s); lvStops->SetItemText(event.GetItem().GetId(),std::string("+") + t.toString()); ((Line::Stop*)event.GetData())->time = t; panTimetable->setOffset(t); panTimetable->refresh(); lvStops->SortItems(StopCompareFunc, 0); event.Veto(); }
void CSourcesListBox::EndEditLabel( wxListEvent& event ) { #if wxVERSION_NUMBER >= 2500 if(event.IsEditCancelled()) return; #endif wxString sCheck = event.GetText(); sCheck.Replace( wxT( " " ), wxT( "" ), TRUE ); if ( sCheck.IsEmpty() ) return; // do not want to rename to an empty string ( or one that only consists of spaces EMUSIK_SOURCES_TYPE nType = GetType( event.GetIndex() ); wxString sType; if(!GetTypeAsString(nType,sType)) { wxASSERT(FALSE); return; } //--- Musik Library entry edited ---// if ( nType == MUSIK_SOURCES_LIBRARY ) { } //--- Now Playing entry edited ---// else if ( nType == MUSIK_SOURCES_NOW_PLAYING ) { } //--- "playlist with data in a file" renamed ---// else { //--- rename file ---// wxString sOldFile = OnGetItemText(event.GetIndex(),0); wxString sNewFile = event.GetText(); SourcesToFilename( &sOldFile, nType ); SourcesToFilename( &sNewFile, nType ); wxRenameFile( sOldFile, sNewFile ); } //--- rename in musiksources.dat ---// m_SourcesList.Item( event.GetIndex() ) = sType + event.GetText(); }
void DataModelListCtrl::OnEndLabelEdit(wxListEvent& event) { if (!event.IsEditCancelled()) { wxDataModelBase* db = GetModel(); const wxString str = event.GetLabel(); const int pos = GetFirstSelected(); bool ok = (pos != wxNOT_FOUND); wxString errorMsg = _("Failed"); if (ok) { wxDataModelColumnInfo info; ok = GetModel()->GetColumn(m_column_clicked, &info); if (ok && (info.VariantType == wxT("string")) ) { ok = (str.length() <= info.Length); if (!ok) errorMsg = _("Text too long"); } if (ok) { wxVariant var = str; if (ok) ok = db->SetValueByRow(var, pos, m_column_clicked); } } if (!ok) { wxMessageBox(errorMsg); event.Veto(); } } m_column_clicked = wxNOT_FOUND; }
void CLocalListView::OnEndLabelEdit(wxListEvent& event) { if (event.IsEditCancelled()) return; int index = event.GetIndex(); if (!index && m_hasParent) { event.Veto(); return; } if (event.GetLabel() == _T("")) { event.Veto(); return; } wxString newname = event.GetLabel(); #ifdef __WXMSW__ newname = newname.Left(255); if ((newname.Find('/') != -1) || (newname.Find('\\') != -1) || (newname.Find(':') != -1) || (newname.Find('*') != -1) || (newname.Find('?') != -1) || (newname.Find('"') != -1) || (newname.Find('<') != -1) || (newname.Find('>') != -1) || (newname.Find('|') != -1)) { wxMessageBox(_("Filenames may not contain any of the following characters: / \\ : * ? \" < > |"), _("Invalid filename"), wxICON_EXCLAMATION); event.Veto(); return; } SHFILEOPSTRUCT op; memset(&op, 0, sizeof(op)); wxString dir = m_dir; if (dir.Right(1) != _T("\\") && dir.Right(1) != _T("/")) dir += _T("\\"); wxString from = dir + m_fileData[m_indexMapping[index]].name + _T(" "); from.SetChar(from.Length() - 1, '\0'); op.pFrom = from; wxString to = dir + newname + _T(" "); to.SetChar(to.Length()-1, '\0'); op.pTo = to; op.hwnd = (HWND)GetHandle(); op.wFunc = FO_RENAME; op.fFlags = FOF_ALLOWUNDO; if (SHFileOperation(&op)) event.Veto(); else { m_fileData[m_indexMapping[index]].name = newname; return; } #else if ((newname.Find('/') != -1) || (newname.Find('*') != -1) || (newname.Find('?') != -1) || (newname.Find('<') != -1) || (newname.Find('>') != -1) || (newname.Find('|') != -1)) { wxMessageBox(_("Filenames may not contain any of the following characters: / * ? < > |"), _("Invalid filename"), wxICON_EXCLAMATION); event.Veto(); return; } wxString dir = m_dir; if (dir.Right(1) != _T("\\") && dir.Right(1) != _T("/")) dir += _T("\\"); if (wxRename(dir + m_fileData[m_indexMapping[index]].name, dir + newname)) m_fileData[m_indexMapping[index]].name = newname; else event.Veto(); #endif }
int bmx_wxlistevent_iseditcancelled(wxListEvent & event) { return static_cast<int>(event.IsEditCancelled()); }
void MainFrame::OnListEndLabel(wxListEvent& evt) { if (evt.IsEditCancelled()) return; wxTreeItemId tree_id = m_pTree->GetSelection(); if (!tree_id) { evt.Veto(); return; } TreeItemData* pItem = (TreeItemData*)m_pTree->GetItemData(tree_id); if (!pItem) { evt.Veto(); return; } wxString strOld = m_pList->GetItemText(evt.GetIndex()); try { if (!pItem->RenameValue(Omega::string_t(strOld.wc_str(),Omega::string_t::npos),Omega::string_t(evt.GetLabel().wc_str(),Omega::string_t::npos))) { wxMessageBox(wxString::Format(_("Cannot rename %s: The specified value name already exists. Type another name and try again."),strOld.c_str()),_("Error Renaming Value"),wxOK|wxICON_ERROR,this); evt.Veto(); } } catch (Omega::IAlreadyExistsException* pE) { pE->Release(); wxMessageBox(wxString::Format(_("Cannot rename %s: The specified value name already exists. Type another name and try again."),strOld.c_str()),_("Error Renaming Value"),wxOK|wxICON_ERROR,this); evt.Veto(); } catch (Omega::Registry::IBadNameException* pE) { pE->Release(); wxMessageBox(wxString::Format(_("Cannot rename %s: The specified value name is invalid. Type another name and try again."),strOld.c_str()),_("Error Renaming Value"),wxOK|wxICON_ERROR,this); evt.Veto(); } catch (Omega::Registry::IAccessDeniedException* pE) { pE->Release(); wxMessageBox(wxString::Format(_("Cannot rename %s: You do not have permission to edit this part of the registry."),strOld.c_str()),_("Error Renaming Value"),wxOK|wxICON_ERROR,this); evt.Veto(); } catch (Omega::IException* pE) { wxMessageBox(pE->GetDescription().c_wstr(),_("System Error"),wxOK|wxICON_ERROR,this); pE->Release(); evt.Veto(); } catch (...) { evt.Veto(); throw; } }