void ViewFilesDialog::OnFviewFmtBest(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); pCombo->SetCurSel(0); // best is always at the top OnFormatSelChange(); pCombo->SetFocus(); }
BOOL CTagDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here // if tagging line don't add items to combobox if (tagLine) { return TRUE; } // Add items from tag lists to the combobox depending on data type switch (dataType) { case 0 : { for (int i=0; i<boolTags->GetSize(); i++) { m_Tag.AddString(boolTags->GetAt(i)); } break; } case 1 : { for (int i=0; i<intTags->GetSize(); i++) { m_Tag.AddString(intTags->GetAt(i)); } break; } case 2 : { for (int i=0; i<realTags->GetSize(); i++) { m_Tag.AddString(realTags->GetAt(i)); } break; } case 3 : { for (int i=0; i<stringTags->GetSize(); i++) { m_Tag.AddString(stringTags->GetAt(i)); } break; } case 4 : { for (int i=0; i<eventTags->GetSize(); i++) { m_Tag.AddString(eventTags->GetAt(i)); } break; } } CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_TAG_COMBO); if(pCombo != NULL) { pCombo->SetFocus(); return 0; //since we are explicity setting focus } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void ViewFilesDialog::OnFviewFmtRaw(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); int sel = FindByVal(pCombo, ReformatHolder::kReformatRaw); if (sel < 0) sel = 0; pCombo->SetCurSel(sel); OnFormatSelChange(); pCombo->SetFocus(); }
BOOL CEnterOptionsNameDlg::OnInitDialog() { __super::OnInitDialog(); CComboBox *cb = getNameCombo(); const StringArray names = Options::getExistingNames(); for(size_t i = 0; i < names.size(); i++) { cb->AddString(names[i].cstr()); } cb->SetFocus(); if((cb->GetCount() == 0) || (m_name.GetLength() == 0)) { cb->SetCurSel(0); } else { cb->SetCurSel((int)names.getFirstIndex((LPCTSTR)m_name)); } return false; }
//初始化函数 BOOL CSetChip::OnInitDialog() { __super::OnInitDialog(); //设置标题 SetWindowText(TEXT("压注")); //计算押注 LONG lChipsArray[SET_CHIP_COUNT] ; //数据验证 ASSERT( m_wMaxChip > 0 ) ; if ( m_wMaxChip <= 0 ) return TRUE ; for ( BYTE cbChipIndex = 0; cbChipIndex < SET_CHIP_COUNT; ++cbChipIndex ) { lChipsArray[cbChipIndex] = LONG ( ( cbChipIndex + 1.0 ) / SET_CHIP_COUNT * m_wMaxChip ) ; //整百处理 if ( lChipsArray[cbChipIndex] > 100 ) { LONG lHundredCount = lChipsArray[cbChipIndex] / 100 ; lChipsArray[cbChipIndex] = lHundredCount * 100 ; } } //插入押注 CComboBox *pChipComBox = ( CComboBox* ) GetDlgItem( IDC_SETCHIP ) ; CString strChip ; for ( BYTE cbChipIndex = 0; cbChipIndex < SET_CHIP_COUNT; ++cbChipIndex ) { strChip.Format( TEXT( "%ld" ), lChipsArray[cbChipIndex] ) ; pChipComBox->InsertString( cbChipIndex, strChip ) ; } pChipComBox->SetCurSel( 0 ) ; pChipComBox->SetFocus() ; m_nChip = lChipsArray[0] ; return TRUE; }