本文整理汇总了C++中CListBox::SetSel方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::SetSel方法的具体用法?C++ CListBox::SetSel怎么用?C++ CListBox::SetSel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CListBox
的用法示例。
在下文中一共展示了CListBox::SetSel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEditPaste
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();
}
示例2: OnSelchangeEditlist
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);
}
}
示例3: fillSuggestionsList
// 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);
}
}
示例4: OnEditCut
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();
}
示例5: SetFlags
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);
}
}
示例6: OnDownButtonClicked
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 );
}
}
}
}
示例7: OnUpButtonClicked
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 );
}
}
}
}
示例8: OnInitDialog
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;
}
示例9: OnButtonUp
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);
}