void CChangeOrderDlg::OnEditPaste() { CListBox *lb = getListBox(); int pos = lb->GetCurSel(); for(size_t i = 0; i < m_buffer.size(); i++) { insertMediaFile(pos,m_buffer[i]); } for(int i = 0; i < lb->GetCount(); i++) { lb->SetSel(i,false); } if(m_buffer.size() > 0) { lb->SetSel(pos); } Invalidate(); }
void CChangeOrderDlg::OnSelchangeEditlist() { CListBox *lb = getListBox(); int i = lb->GetCurSel(); if(i == lb->GetCount()-1) { // never select the last empty String lb->SetSel(lb->GetCount() - 1, false); } }
// fillSuggestionsList: // Fill the suggestions list with suggestions for the current word. void CSpellingDlg::fillSuggestionsList() { CWaitCursor busy; SSCE_CHAR problemWord[SSCE_MAX_WORD_SZ]; GetDlgItemText(IDC_PROBLEMWORD, (TCHAR *)problemWord, sizeof(problemWord)); const int maxSuggestions = 16; SSCE_CHAR suggestions[maxSuggestions * SSCE_MAX_WORD_SZ]; SSCE_S16 scores[maxSuggestions]; SSCE_Suggest(SSCE_GetSid(), problemWord, suggestionDepth, suggestions, sizeof(suggestions), scores, maxSuggestions); CListBox *suggestionsList = (CListBox *)GetDlgItem(IDC_SUGGESTIONSLIST); suggestionsList->ResetContent(); for (const SSCE_CHAR *p = suggestions; *p != _T('\0'); p += lstrlen((TCHAR *)p) + 1) { suggestionsList->AddString((TCHAR *)p); } // Select the first suggestion and copy it to the Change To field. if (suggestionsList->GetCount() > 0) { suggestionsList->SetSel(0); CString word1; suggestionsList->GetText(0, word1); SetDlgItemText(IDC_CHANGETO, word1); } }
void CChangeOrderDlg::OnEditCut() { CListBox *lb = getListBox(); int pos = lb->GetCurSel(); CompactIntArray selected; getSelected(selected); m_buffer.clear(); for(size_t i = 0; i < selected.size(); i++) { m_buffer.add(m_editList[selected[i]]); } removeSelected(selected); if(pos < lb->GetCount()) { lb->SetSel(pos); } else { lb->SetSel(lb->GetCount()-1); } Invalidate(); }
void DlgGuardFlags::SetFlags() { CListBox* lb; lb = (CListBox*)GetDlgItem(IDC_GUARD_FLAGS); for(int i = 0; i < GuardBitCount(); i++) { if(IS_SET(flags, guard_bits[i].bit)) lb->SetSel(i); } }
void CSelectDialog::OnDownButtonClicked() { CListBox* chosenList = (CListBox*)GetDlgItem( IDC_CHOSENLIST ); for ( int i=chosenList->GetCount()-2; i>=0; i-- ) { if ( chosenList->GetSel( i ) ) { if ( !chosenList->GetSel( i+1 ) ) { char temp[4000]; chosenList->GetText( i+1, temp ); chosenList->InsertString( i, temp ); chosenList->SetSel( i+2, TRUE ); chosenList->DeleteString( i+2 ); } } } }
void CSelectDialog::OnUpButtonClicked() { CListBox* chosenList = (CListBox*)GetDlgItem( IDC_CHOSENLIST ); for ( int i=1; i<chosenList->GetCount(); i++ ) { if ( chosenList->GetSel( i ) ) { char temp[4000]; if ( !chosenList->GetSel( i-1 ) ) { chosenList->GetText( i, temp ); chosenList->InsertString( i-1, temp ); chosenList->SetSel( i-1, TRUE ); chosenList->DeleteString( i+1 ); } } } }
BOOL CChangeOrderDlg::OnInitDialog() { m_accelTable = LoadAccelerators(theApp.m_hInstance,MAKEINTRESOURCE(IDR_CHANGEORDER_ACCELERATOR)); for(size_t i = 0; i < m_mediaQueue.size(); i++) { insertMediaFile(i,m_mediaQueue[i]); } CListBox *lb = getListBox(); lb->InsertString((int)m_mediaQueue.size(),EMPTYSTRING); __super::OnInitDialog(); gotoToListBox(); if(!m_mediaQueue.isEmpty()) { lb->SetSel(0); } return false; }
void CSaveMovieDialog::OnButtonUp() { CListBox * pListBox = (CListBox *)GetDlgItem(IDC_LIST_BITMAP_FILENAME); if ( pListBox->GetSelCount() != 1 ) return; if ( pListBox->GetCurSel() <= 0 ) return; int sel = pListBox->GetCurSel(); CString currentText; pListBox->GetText (sel, currentText ); pListBox->InsertString(sel-1 , currentText); pListBox->DeleteString(sel+1); pListBox->SetSel(sel-1, TRUE); }