void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl) { int Index = ctrl.AddString("32 bits (aligned)"); ctrl.SetItemData(Index, _32Bit); Index = ctrl.AddString("16bits (aligned)"); ctrl.SetItemData(Index, _16Bit); Index = ctrl.AddString("8bits"); ctrl.SetCurSel(Index); ctrl.SetItemData(Index, _8Bit); }
void CDebugMemorySearch::AddAlignmentOptions (CComboBox & ctrl) { /*int Index =*/ ctrl.AddString("32 bits (aligned)"); g_Notify->BreakPoint(__FILE__,__LINE__); #ifdef tofix ctrl.SetItemData(Index,_32Bit); Index = ctrl.AddString("16bits (aligned)"); ctrl.SetItemData(Index,_16Bit); Index = ctrl.AddString("8bits"); ctrl.SetCurSel(Index); ctrl.SetItemData(Index,_8Bit); #endif }
//----------------------------- FUNCTION -------------------------------------* BOOL PropGSDModule::OnSetActive() { // TODO: Add your specialized code here and/or call the base class CComboBox* pUsedModules = (CComboBox*)GetDlgItem(IDC_COMBO_USED_MODULES); if (pUsedModules != NULL) { arModules.RemoveAll(); pUsedModules->ResetContent(); m_pModule->GetUsedModules(&arModules); for (int i = 0; i < arModules.GetSize(); i++) { CDP_Module* pModule = (CDP_Module*)arModules.GetAt(i); if (pModule->GetUserPrmLen() != 0) { CString szName; szName.Format(_T("%d: "), i+1); szName += pModule->GetModuleName(); int index = pUsedModules->AddString(szName); pUsedModules->SetItemData(index, (DWORD)pModule); } } pUsedModules->SetCurSel(0); m_pSelModule = NULL; } OnSelchangeUsedModules(); CreateExtUserParams(); return CPropertyPage::OnSetActive(); }
void AppendNotesToControl(CComboBox& combobox, const modplug::tracker::note_t noteStart, const modplug::tracker::note_t noteEnd) //------------------------------------------------------------------------------------------------------------------ { const modplug::tracker::note_t upperLimit = bad_min(CountOf(szDefaultNoteNames)-1, noteEnd); for(modplug::tracker::note_t note = noteStart; note <= upperLimit; ++note) combobox.SetItemData(combobox.AddString(szDefaultNoteNames[note]), note); }
BOOL CMidiSetupDlg::OnInitDialog() //-------------------------------- { MIDIINCAPS mic; CComboBox *combo; CPropertyPage::OnInitDialog(); // Flags if (m_dwMidiSetup & MIDISETUP_RECORDVELOCITY) CheckDlgButton(IDC_CHECK1, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_RECORDNOTEOFF) CheckDlgButton(IDC_CHECK2, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_AMPLIFYVELOCITY) CheckDlgButton(IDC_CHECK3, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_TRANSPOSEKEYBOARD) CheckDlgButton(IDC_CHECK4, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_MIDITOPLUG) CheckDlgButton(IDC_MIDI_TO_PLUGIN, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_MIDIMACROCONTROL) CheckDlgButton(IDC_MIDI_MACRO_CONTROL, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_MIDIVOL_TO_NOTEVOL) CheckDlgButton(IDC_MIDIVOL_TO_NOTEVOL, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_RESPONDTOPLAYCONTROLMSGS) CheckDlgButton(IDC_MIDIPLAYCONTROL, MF_CHECKED); if (m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN) CheckDlgButton(IDC_MIDIPLAYPATTERNONMIDIIN, MF_CHECKED); // Midi In Device if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) { UINT ndevs = midiInGetNumDevs(); for (UINT i=0; i<ndevs; i++) { mic.szPname[0] = 0; if (midiInGetDevCaps(i, &mic, sizeof(mic)) == MMSYSERR_NOERROR) combo->SetItemData(combo->AddString(mic.szPname), i); } combo->SetCurSel((m_nMidiDevice == MIDI_MAPPER) ? 0 : m_nMidiDevice); } m_SpinSpd.SetRange(2, 6); m_SpinPat.SetRange(64, 256); return TRUE; }
LRESULT RecipePanel::onInitDialog(UINT/*uMsg*/, WPARAM/*wParam*/, LPARAM/*lParam*/, BOOL&/*bHandled*/) { SetWindowText(_T("Filter View")); updateCharList(); { CComboBox cb = GetDlgItem(IDC_RECIPECOMBO); auto recipes = m_recipeLoader.getRecipes(); cb.ResetContent(); int item = cb.AddString(_T("-")); for (unsigned int i = 0; i < recipes.size(); i++) { std::tstring name = recipes[i]; if ((item = cb.AddString(name.c_str())) != CB_ERR) { cb.SetItemData(item, i); } } cb.SetCurSel(0); } signalSettingsChanged(); return 0; }
LRESULT CPrefsLanguageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CComboBox langList = GetDlgItem(IDC_LANGUAGE_LIST); for (int i = 0; i < g_numLanguages; i++) { int index = langList.AddString(languageCodes[i].name); langList.SetItemData(index, i); } // Set currently selected language { for (int i = 0; i < g_numLanguages; i++) { ASSERT(0); #if 0 if (wcscmp(languageCodes[i].code, m_pPrefs->m_systemLanguage.c_str()) == 0) break; #endif } if (i < g_numLanguages) { langList.SelectString(-1, languageCodes[i].name); } } CheckRadioButton(IDC_SYSTEM_SUBTITLES, IDC_SYSTEM_SUBTITLES+1, IDC_SYSTEM_SUBTITLES+m_pPrefs->m_systemOverdubOrSubtitle); CheckDlgButton(IDC_SYSTEM_CAPTIONS, m_pPrefs->m_systemCaptions); CheckDlgButton(IDC_SYSTEM_AUDIODESC, m_pPrefs->m_systemAudioDesc); return 1; // Let the system set the focus }
void CTxMsgWndJ1939::vInitializeNmFields(void) { //Set the properties of the field first m_omCurAddress.vSetBase(BASE_HEXADECIMAL); m_omCurAddress.vSetSigned(false); m_omCurAddress.LimitText(2); m_omEcuName.vSetBase(BASE_HEXADECIMAL); m_omEcuName.vSetSigned(false); m_omEcuName.LimitText(16); m_omDLCEdit.LimitText(4); m_bNM = TRUE; CButton* pButton = (CButton*) GetDlgItem(IDC_RADIO_NM); pButton->SetCheck(BST_CHECKED); //Populate the values pButton = (CButton*)GetDlgItem(IDC_RQST_ADDRESS); pButton->SetCheck(BST_UNCHECKED); pButton = (CButton*)GetDlgItem(IDC_CMD_ADDRESS); pButton->SetCheck(BST_UNCHECKED); pButton = (CButton*)GetDlgItem(IDC_CLAIM_ADDRESS); pButton->SetCheck(BST_CHECKED); CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_NODE); int nIndex = pComboBox->AddString(m_sClientParams.m_acName); pComboBox->SetItemData(nIndex, m_sClientParams.m_byAddress); pComboBox->SetCurSel(nIndex); m_omEcuName.vSetValue(m_sClientParams.m_unEcuName); m_omCurAddress.vSetValue(m_sClientParams.m_byAddress); UpdateData(TRUE); }
void FindView::updateDimensionList() { int item = -1; CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO); cb.ResetContent(); std::map<unsigned int, std::tstring> dimensionNames; g_DBManager.Lock(); g_DBManager.GetDimensions(dimensionNames); sqlite::ITablePtr pT = m_db->ExecTable(_T("SELECT DISTINCT dimensionid FROM tToons")); g_DBManager.UnLock(); // Add named dimensions. for (std::map<unsigned int, std::tstring>::iterator it = dimensionNames.begin(); it != dimensionNames.end(); ++it) { if ((item = cb.AddString(it->second.c_str())) != CB_ERR) { cb.SetItemData(item, it->first); } } // Add un-named dimensions. for (unsigned int i = 0; i < pT->Rows(); ++i) { unsigned int dimId = boost::lexical_cast<unsigned int>(pT->Data(i, 0)); std::tstring dimName; if (dimensionNames.find(dimId) != dimensionNames.end()) { continue; // Skip named ones. } else { dimName = _T("Unknown Dimension"); if (dimId > 0) { dimName += STREAM2STR(" (0x" << std::hex << dimId << ")"); } } if ((item = cb.AddString(dimName.c_str())) != CB_ERR) { cb.SetItemData(item, dimId); } } }
void FindView::updateCharList(unsigned int dimension_id) { CComboBox cb = GetDlgItem(IDC_CHARCOMBO); cb.ResetContent(); int item = cb.AddString(_T("-")); cb.SetItemData(item, 0); boost::format sql("SELECT DISTINCT owner FROM tItems I JOIN tToons T ON I.owner = T.charid WHERE dimensionid = %1% ORDER BY T.charname"); sql % dimension_id; g_DBManager.Lock(); sqlite::ITablePtr pT = m_db->ExecTable(sql.str()); g_DBManager.UnLock(); if (pT != NULL) { for (unsigned int i = 0; i < pT->Rows(); i++) { try { unsigned int id = boost::lexical_cast<unsigned int>(pT->Data(i, 0)); g_DBManager.Lock(); std::tstring name = g_DBManager.GetToonName(id); g_DBManager.UnLock(); if (name.empty()) { name = from_ascii_copy(pT->Data(i, 0)); } if ((item = cb.AddString(name.c_str())) != CB_ERR) { cb.SetItemData(item, id); } } catch (boost::bad_lexical_cast&/*e*/) { // This is here because of a wierd but that appears to be SQLite's fault. LOG("Error in updateCharList(). Bad lexical cast at row " << i << "."); continue; } } } }
void AppendNotesToControlEx(CComboBox& combobox, const module_renderer* const pSndFile /* = nullptr*/, const modplug::tracker::instrumentindex_t nInstr/* = MAX_INSTRUMENTS*/) //---------------------------------------------------------------------------------------------------------------------------------- { const modplug::tracker::note_t noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1; const modplug::tracker::note_t noteEnd = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMax : NoteMax; for(modplug::tracker::note_t nNote = noteStart; nNote <= noteEnd; nNote++) { if(pSndFile != nullptr && nInstr != MAX_INSTRUMENTS) combobox.SetItemData(combobox.AddString(pSndFile->GetNoteName(nNote, nInstr).c_str()), nNote); else combobox.SetItemData(combobox.AddString(szDefaultNoteNames[nNote-1]), nNote); } for(modplug::tracker::note_t nNote = NoteMinSpecial-1; nNote++ < NoteMaxSpecial;) { if(pSndFile == nullptr || pSndFile->GetModSpecifications().HasNote(nNote) == true) combobox.SetItemData(combobox.AddString(szSpecialNoteNames[nNote-NoteMinSpecial]), nNote); } }
BOOL CBerkeleyView::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: Add extra initialization here CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_DATA_TYPE); pBox->AddString(_T("String")); pBox->SetItemData(0, DataDecoder::eDTString); pBox->AddString(_T("Bitmap")); pBox->SetItemData(0, DataDecoder::eDTBitmap); pBox->AddString(_T("LZ")); pBox->SetItemData(0, DataDecoder::eDTLZ); pBox->AddString(_T("RLE")); pBox->SetItemData(0, DataDecoder::eDTRLE); pBox->SelectString(0, _T("String")); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void WINAPI addAMTKListByType(CComboBox &cList, WORD wAccessType) { int i; cList.ResetContent(); for (i = 0; i < AMTK_ITEM_ALL_NUM; i++) { if (l_tAMTKItems[i].wType & wAccessType) { cList.SetItemData(cList.AddString(l_tAMTKItems[i].lpcszName), i); } } }
BOOL CDlgRename::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* pCBox = (CComboBox *) GetDlgItem( IDC_CMB_FORMATS ); int nDefaultIndex; theApp.m_nFormatCount; if( theApp.m_nFormatCount != 0 ) { for( int i = 0 ; i < theApp.m_nFormatCount ; i++ ) { CFormat* pFormat = new CFormat(); pFormat->Load( i + 1 ); if( i == theApp.m_nDefaultFormat ) { nDefaultIndex = i; } int nIndex = pCBox->AddString( pFormat->m_strName ); pCBox->SetItemData( nIndex , (DWORD) pFormat ); } pCBox->SetCurSel( nDefaultIndex ); if( m_bSingleFile ) { SetMode( FORMAT_FREE ); } else { // Griser le mode Nom libre GetDlgItem( IDC_FORMAT_FREE )->EnableWindow( FALSE ); SetMode( FORMAT_PREDEFINED ); } } else { if( m_bSingleFile ) { // Disable the combo GetDlgItem( IDC_CMB_FORMATS )->EnableWindow( FALSE ); GetDlgItem( IDC_FORMAT_PREDEFINED )->EnableWindow( FALSE ); SetMode( FORMAT_FREE ); } else { // No format availbale => can't rename CString strMsg = theApp.LoadTranslatedString( "IdsErrorFormatNotAvailable" ); MessageBox( strMsg , NULL, MB_ICONWARNING ); EndDialog(FALSE); } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void KG3DAnimationContainer::FillAnimationComboBox(CComboBox& ComboBox) { ComboBox.ResetContent(); LPCTSTR pszAniName = NULL; for (int i = 0; i < static_cast<int>(m_Clips.size()); i++) { m_Clips[i]->GetName(&pszAniName); ComboBox.InsertString(i, pszAniName); ComboBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i])); } }
int CALLBACK CFontsPage::FillInCharsets(const ENUMLOGFONTEX* lpelfe,const TEXTMETRIC* lpntme,const int FontType,const LPARAM lParam) { // if(FontType!=TRUETYPE_FONTTYPE) // return 1; CComboBox* cb = (CComboBox*)lParam; ASSERT(cb); if(cb->FindString(0,(char*)lpelfe->elfScript)>=0) return 1; int i = cb->AddString((char*)lpelfe->elfScript); ASSERT(i>=0); VERIFY(cb->SetItemData(i,lpelfe->elfLogFont.lfCharSet)!=LB_ERR); return 1; }
void CValueList::FillComboBox(CComboBox &cb) { CValueItem vi; int nItem; POSITION pos = GetHeadPosition(); while(pos) { vi = GetNext(pos); nItem = cb.AddString(vi.m_strText); cb.SetItemData(nItem,vi.m_nValue); } }
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ void AddStrToCombo ( CComboBox & ComboBox, UINT StrID, DWORD Value, int & CurSel, DWORD DefaultValue ) { CString str ( ( LPCSTR ) StrID ); int index = ComboBox.AddString ( str ); if ( index >= 0 ) { ComboBox.SetItemData ( index, Value ); if ( DefaultValue == Value ) { CurSel = index; } } }
BOOL CNewTaskDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* pCombo; CBitmap bmp; CRect rectWnd; CRect rectTemp; m_nSignature = 0; m_bConnected = m_pOwner->IsConnected(); m_ilState.Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1); bmp.LoadBitmap(IDB_STATES); int i = m_ilState.Add(&bmp, RGB(255, 0, 255)); bmp.DeleteObject(); rectWnd.SetRectEmpty(); ::ImageList_GetIconSize(m_ilState, (int*)&rectWnd.right, (int*)&rectWnd.bottom); for (BYTE nCS = 0; nCS < MAX_CS; nCS++) { GetDlgItem(IDC_LABLE_CE0 + nCS)->GetWindowRect(rectTemp); ScreenToClient(rectTemp); rectWnd.MoveToXY(rectTemp.right+1, rectTemp.top-1); m_pStateCS[nCS] = new CStatic; m_pStateCS[nCS]->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON, rectWnd, this); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VCC); for (BYTE i = PowerIO_1_8; i < CountPowerIO; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPowerIO(i)), i); } SetComboSelection(pCombo, PowerIO_1_8); GetDlgItem(IDC_LABEL_RECORDS)->GetWindowRect(rectWnd); ScreenToClient(rectWnd); m_FlashParametersDlg.Create(this, rectWnd.TopLeft(), FALSE); m_FlashRecordsDlg.Create(this, rectWnd.TopLeft()); GetDlgItem(IDC_COMBO_VCC)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_CHECK)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_RESET)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ID)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_VENDOR)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ONFI)->EnableWindow(m_bConnected); ((CButton*)GetDlgItem(IDC_SELECT_BASE))->SetCheck(BST_CHECKED); OnSelectChange(IDC_SELECT_BASE); OnClickedBtnReset(); SetButtonOK(); return TRUE; }
BOOL CWallTool::OnInitDialog () { static char* pszWallTypes [] = { "Normal", "Blastable", "Door", "Illusion", "Open", "Close", "Overlay", "Cloaked", "Transparent" }; GetMine (); CComboBox *pcb; CTexToolDlg::OnInitDialog (); InitCBWallNo (); pcb = CBType (); pcb->ResetContent (); int h, i, j = sizeof (pszWallTypes) / sizeof (*pszWallTypes); for (i = 0; i < j; i++) { h = pcb->AddString (pszWallTypes [i]); pcb->SetItemData (h, i); } pcb = CBClipNo (); pcb->ResetContent (); j = (file_type != RDL_FILE) ? D2_NUM_OF_CLIPS : NUM_OF_CLIPS; for (i = 0; i < j; i++) { sprintf (m_szMsg, i ? "door%02d" : "wall%02d", clip_door_number [i]); pcb->AddString (m_szMsg); } InitSlider (IDC_WALL_TRANSPARENCY, 0, 10); for (i = 0; i <= 10; i++) SlCtrl (IDC_WALL_TRANSPARENCY)->SetTic (i); *m_szMsg = '\0'; m_bInited = true; return TRUE; }
BOOL CPageStart::OnInitDialog() { CPropertyPage::OnInitDialog(); CComboBox* pCombo; CBitmap bmp; CRect rectWnd; CRect rectTemp; m_pSheet = (CNewTaskDlg*)GetParent(); m_ilState.Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1); bmp.LoadBitmap(IDB_STATES); int i = m_ilState.Add(&bmp, RGB(255, 0, 255)); bmp.DeleteObject(); rectWnd.SetRectEmpty(); ::ImageList_GetIconSize(m_ilState, (int*)&rectWnd.right, (int*)&rectWnd.bottom); for (BYTE nCS = 0; nCS < MAX_CS; nCS++) { GetDlgItem(IDC_LABLE_CE0 + nCS)->GetWindowRect(rectTemp); ScreenToClient(rectTemp); rectWnd.MoveToXY(rectTemp.right+1, rectTemp.top-1); m_pStateCS[nCS] = new CStatic; m_pStateCS[nCS]->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON, rectWnd, this); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VCC); for (BYTE i = 0; i < CountPower; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPower(i)), i); } SetSelection(pCombo, Power_1_8); GetDlgItem(IDC_LABEL_RECORDS)->GetWindowRect(rectWnd); ScreenToClient(rectWnd); m_FlashParametersDlg.Create(this, rectWnd.TopLeft()); m_FlashRecordsDlg.Create(this, rectWnd.TopLeft()); m_bCheckSuccess = FALSE; m_bConnected = m_pSheet->m_pOwner->IsConnected(); m_nSelectID = m_bConnected ? IDC_SELECT_CHECK : IDC_SELECT_BASE; ((CButton*)GetDlgItem(IDC_SELECT_CHECK))->EnableWindow(m_bConnected); ((CButton*)GetDlgItem(m_nSelectID))->SetCheck(BST_CHECKED); m_bCheckSuccess = FALSE; m_nSignature = NO_FILTER_ID; SetCheckControls(); return TRUE; }
/** * Function name CObjPropFunctDecl::FillComboBox * Description fills the combobox * @param int iCBId * @param const char * const pszItems[] * @param int iDefault * @return - * @exception - * @see - */ void CObjPropFunctDecl::FillComboBox(int iCBId, const char * const pszItems[], int iDefault) { int iCount = 0; int iIndex = 0; CComboBox * pCBox = (CComboBox *)(this->GetDlgItem(iCBId)); ASSERT(NULL != pCBox); pCBox->ResetContent(); while(_tcscmp(pszItems[iCount], _T(""))) { iIndex = pCBox->AddString(pszItems[iCount]); pCBox->SetItemData(iIndex, (DWORD)iCount); iCount++; } if(iDefault >= 0) { pCBox->SetCurSel(iDefault); } }
// init rss interval combobox void CPPgGeneral::InitRssIntervalComboBox(CComboBox & cboInterval, UINT uCurrValue) { CString strMin = GetResString(IDS_MINS); CString strHour = GetResString(IDS_HOURS); // 初始化rss更新时间 struct RSS_INTERVAL_STRUCT { RSS_INTERVAL_STRUCT(const CString & strText, UINT uIntervalSecond) : m_strText(strText), m_uIntervalSecond(uIntervalSecond) { } CString m_strText; UINT m_uIntervalSecond; }; RSS_INTERVAL_STRUCT RssStructs[] = { RSS_INTERVAL_STRUCT(_T("30") + strMin, 30 * 60), RSS_INTERVAL_STRUCT(_T("1") + strHour, 1 * 60 * 60), RSS_INTERVAL_STRUCT(_T("2") + strHour, 2 * 60 * 60), RSS_INTERVAL_STRUCT(_T("3") + strHour, 3 * 60 * 60), RSS_INTERVAL_STRUCT(_T("6") + strHour, 6 * 60 * 60), RSS_INTERVAL_STRUCT(_T("12") + strHour, 12 * 60 * 60) }; cboInterval.ResetContent(); for ( int iStructIndex = 0; iStructIndex < sizeof(RssStructs) / sizeof(RssStructs[0]); ++ iStructIndex ) { int iAddIndex = cboInterval.AddString(RssStructs[iStructIndex].m_strText); if ( iAddIndex >= 0 ) { cboInterval.SetItemData(iAddIndex, RssStructs[iStructIndex].m_uIntervalSecond); if ( RssStructs[iStructIndex].m_uIntervalSecond == uCurrValue ) { cboInterval.SetCurSel(iAddIndex); } } } }
BOOL CCubeTool::OnInitDialog () { static char* pszCubeTypes [] = { "Normal", "Fuel Center", "Repair Center", "Reactor", "Robot Maker", "Blue Goal", "Red Goal", "Water", "Lava", "Blue Team", "Red Team", "Speed Boost", "Blocked", "No Damage", "Sky Box", "Equip Maker", "Outdoors" }; CToolDlg::OnInitDialog (); CComboBox *pcb = CBType (); pcb->ResetContent (); int h, i, j; for (j = sizeof (pszCubeTypes) / sizeof (*pszCubeTypes), i = 0; i < j; i++) { h = pcb->AddString (pszCubeTypes [i]); pcb->SetItemData (h, i); } pcb = CBOwner (); pcb->ResetContent (); pcb->AddString ("Neutral"); pcb->AddString ("Unowned"); pcb->AddString ("Blue Team"); pcb->AddString ("Red Team"); m_bInited = TRUE; return TRUE; }
BOOL CImageProcessDlg::ResetDevice(IDevice *pDevice, BOOL bInit) { if(bInit || m_pDevice != pDevice) { InterlockedExchangePointer((PVOID *)&m_pDevice, pDevice); EnableWindow(m_pDevice != NULL); if(m_pDevice != NULL) { DeviceCapability devCapability; m_pDevice->GetCapability(&devCapability); m_ctrlRGain.SetRange(devCapability.sRGBGainRange.ucRGainMin, devCapability.sRGBGainRange.ucRGainMax); m_ctrlGGain.SetRange(devCapability.sRGBGainRange.ucGGainMin, devCapability.sRGBGainRange.ucGGainMax); m_ctrlBGain.SetRange(devCapability.sRGBGainRange.ucRGainMin, devCapability.sRGBGainRange.ucRGainMax); m_ctrlFrameTune.SetRange(1000, 2000); m_ctrlGamma.SetRange((int)(devCapability.sGammaRange.fMin * 10.f), (int)(devCapability.sGammaRange.fMax * 10.f)); m_ctrlContrast.SetRange(devCapability.sContrastRange.shMin, devCapability.sContrastRange.shMax, TRUE); m_ctrlSaturation.SetRange(devCapability.sSaturationRange.iMin, devCapability.sSaturationRange.iMax); BOOL bEnable = !m_pDevice->IsMonochromeDevice(); GetDlgItem(IDC_ONEWB2)->EnableWindow(bEnable); GetDlgItem(IDC_RGAIN_BAR)->EnableWindow(bEnable); GetDlgItem(IDC_GGAIN_BAR)->EnableWindow(bEnable); GetDlgItem(IDC_BGAIN_BAR)->EnableWindow(bEnable); GetDlgItem(IDC_SATURATION_BAR)->EnableWindow(bEnable); GetDlgItem(IDC_CHK_SATURATION)->EnableWindow(bEnable); GetDlgItem(IDC_MONO)->EnableWindow(bEnable); CComboBox *pComboSpeed = (CComboBox *)GetDlgItem(IDC_CMB_FRAMESPEED); pComboSpeed->ResetContent(); for(int i = 0; i < devCapability.iFrameSpeed; ++i) { int Index = pComboSpeed->AddString(devCapability.pFrameSpeed[i].strDescription); pComboSpeed->SetItemData(Index, devCapability.pFrameSpeed[i].iFrameSpeed); } return TRUE; } } return FALSE; }
//================================================= // Overrides //================================================= BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); // Add "About..." menu item to system menu. CMenu* pSysMenu = GetSystemMenu(FALSE); if(pSysMenu != NULL) { CString strAboutMenu = _T("About..."); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // Set max-length on edit boxes CEdit* pEdit = NULL; VERIFY(pEdit = (CEdit*)GetDlgItem(IDC_IMAGE_NAME)); pEdit->SetLimitText(50); // Fill combo with all supported image formats CComboBox* pCombo = NULL; VERIFY(pCombo = (CComboBox*)GetDlgItem(IDC_IMAGE_EXT)); ImageCodecInfo* pImageCodecInfo = NULL; UINT nCount = 0; // number of image encoders UINT nSize = 0; // size of the image encoder array in bytes GetImageEncodersSize(&nCount, &nSize); if(nSize > 0) { pImageCodecInfo = (ImageCodecInfo*)(malloc(nSize)); if(pImageCodecInfo != NULL) { GetImageEncoders(nCount, nSize, pImageCodecInfo); for(UINT x = 0; x < nCount; x ++) { CString strFormat(pImageCodecInfo[x].FormatDescription); int iItem = pCombo->AddString(strFormat); ASSERT(iItem != -1); CLSID* pCLSID = new CLSID; ASSERT(pCLSID); *pCLSID = pImageCodecInfo[x].Clsid; pCombo->SetItemData(iItem, (DWORD_PTR)pCLSID); // JPEG will be our default image type if(strFormat.CompareNoCase(_T("jpeg")) == 0) { m_clsidImgType = pImageCodecInfo[x].Clsid; pCombo->SetCurSel(iItem); } } free(pImageCodecInfo); } } SetControlValues(); // Start keyboard hook to capture the print screen key ActivateKeyboardHook(TRUE); return TRUE; // return TRUE unless you set the focus to a control }
BOOL CAdvancedDlg::OnInitDialog() { CPWDialog::OnInitDialog(); CString cs_text, cs_tmp; int iItem(-1); m_bsAllowedFields.reset(); m_bsDefaultSelectedFields.reset(); m_bsMandatoryFields.reset(); m_bsAttAllowedFields.reset(); m_bsAttDefaultSelectedFields.reset(); cs_text.LoadString(m_iIndex == FIND ? IDS_FINDX : IDS_SYNCHRONIZEX); SetWindowText(cs_text); if (m_iIndex != COMPARESYNCH) { CComboBox *cboSubgroupFunction = (CComboBox *)GetDlgItem(IDC_ADVANCED_SUBGROUP_FUNCTION); if (cboSubgroupFunction->GetCount() == 0) { const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS, PWSMatch::MR_NOTEQUAL, PWSMatch::MR_BEGINS, PWSMatch::MR_NOTBEGIN, PWSMatch::MR_ENDS, PWSMatch::MR_NOTEND, PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN, PWSMatch::MR_CNTNANY, PWSMatch::MR_NOTCNTNANY, PWSMatch::MR_CNTNALL, PWSMatch::MR_NOTCNTNALL }; for (size_t i = 0; i < _countof(mrx); i++) { UINT iumsg = PWSMatch::GetRule(mrx[i]); cs_text.LoadString(iumsg); iItem = cboSubgroupFunction->AddString(cs_text); cboSubgroupFunction->SetItemData(iItem, mrx[i]); } } for (int i = 0; i < cboSubgroupFunction->GetCount(); i++) { if ((int)cboSubgroupFunction->GetItemData(i) == m_subgroup_function) { cboSubgroupFunction->SetCurSel(i); break; } } // Note: NOT SORTED by design CComboBox *cboSubgroupObject = (CComboBox *)GetDlgItem(IDC_ADVANCED_SUBGROUP_OBJECT); if (cboSubgroupObject->GetCount () == 0) { const struct { int si; int ii; } subgroupInit[] = { {IDS_GROUP, CItemData::GROUP}, {IDS_GROUPTITLE, CItemData::GROUPTITLE}, {IDS_TITLE, CItemData::TITLE}, {IDS_USERNAME, CItemData::USER}, {IDS_URL, CItemData::URL}, {IDS_NOTES, CItemData::NOTES}, }; for (auto &elem : subgroupInit) { cs_text.LoadString(elem.si); iItem = cboSubgroupObject->AddString(cs_text); cboSubgroupObject->SetItemData(iItem, elem.ii); } } for (int i = 0; i < cboSubgroupObject->GetCount(); i++) { if ((int)cboSubgroupObject->GetItemData(i) == m_subgroup_object) { cboSubgroupObject->SetCurSel(i); break; } } BOOL bEnable = (m_subgroup_set == BST_CHECKED) ? TRUE : FALSE; GetDlgItem(IDC_ADVANCED_SUBGROUP_FUNCTION)->EnableWindow(bEnable); GetDlgItem(IDC_ADVANCED_SUBGROUP_OBJECT)->EnableWindow(bEnable); GetDlgItem(IDC_ADVANCED_SUBGROUP_NAME)->EnableWindow(bEnable); GetDlgItem(IDC_ADVANCED_SUBGROUP_CASE)->EnableWindow(bEnable); } // m_pLC_List are those fields that aren't currently selected but could be // m_pLC_Selected are those fields already selected m_pLC_List = (CListCtrl *)GetDlgItem(IDC_ADVANCED_LIST); m_pLC_Selected = (CListCtrl *)GetDlgItem(IDC_ADVANCED_SELECTED); m_pLC_List->InsertColumn(0, L""); m_pLC_Selected->InsertColumn(0, L""); m_pLC_List->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER); m_pLC_Selected->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER); // Deal with non-text fields if (m_iIndex == COMPARESYNCH) { // All these are already selected fields const struct { int si; int ii; bool is_temporal; } nonTextInit[] = { {IDS_COMPCTIME, CItemData::CTIME, true}, {IDS_COMPPMTIME, CItemData::PMTIME, true}, {IDS_COMPATIME, CItemData::ATIME, true}, {IDS_COMPRMTIME, CItemData::RMTIME, true}, {IDS_COMPXTIME, CItemData::XTIME, true}, {IDS_PASSWORDEXPIRYDATEINT, CItemData::XTIME_INT, false}, {IDS_PWPOLICY, CItemData::POLICY, false}, {IDS_POLICYNAME, CItemData::POLICYNAME, false}, {IDS_DCALONG, CItemData::DCA, false}, {IDS_SHIFTDCALONG, CItemData::SHIFTDCA, false}, {IDS_PROTECTED, CItemData::PROTECTED, false}, {IDS_KBSHORTCUT, CItemData::KBSHORTCUT, false}, }; for (auto &elem : nonTextInit) { cs_text.LoadString(elem.si); if (elem.is_temporal) { // Time fields // Use Compare text and remove the quotes and leading blank cs_text = cs_text.Mid(2, cs_text.GetLength() - 3); } iItem = m_pLC_Selected->InsertItem(++iItem, cs_text); m_pLC_Selected->SetItemData(iItem, elem.ii | NORMALFIELD); m_bsAllowedFields.set(elem.ii); m_bsDefaultSelectedFields.set(elem.ii); } } // non-text fields // Deal with text fields - all selected by default const struct { int si; int ii; } textInit[] = { {IDS_NOTES, CItemData::NOTES}, {IDS_URL, CItemData::URL}, {IDS_AUTOTYPE, CItemData::AUTOTYPE}, {IDS_PWHISTORY, CItemData::PWHIST}, {IDS_RUNCOMMAND, CItemData::RUNCMD}, {IDS_EMAIL, CItemData::EMAIL}, {IDS_SYMBOLS, CItemData::SYMBOLS}, }; for (auto &elem : textInit) { cs_text.LoadString(elem.si); iItem = m_pLC_Selected->InsertItem(++iItem, cs_text); m_pLC_Selected->SetItemData(iItem, elem.ii | NORMALFIELD); m_bsAllowedFields.set(elem.ii); m_bsDefaultSelectedFields.set(elem.ii); } // Deal with standard text fields - selected by default if (m_iIndex == COMPARESYNCH) { cs_text.LoadString(IDS_PASSWORD); iItem = m_pLC_Selected->InsertItem(++iItem, cs_text); m_pLC_Selected->SetItemData(iItem, CItemData::PASSWORD | NORMALFIELD); m_bsAllowedFields.set(CItemData::PASSWORD); m_bsDefaultSelectedFields.set(CItemData::PASSWORD); } else { const struct { int si; int ii; } stdtextInit[] = { {IDS_GROUP, CItemData::GROUP}, {IDS_TITLE, CItemData::TITLE}, {IDS_USERNAME, CItemData::USER}, {IDS_PASSWORD, CItemData::PASSWORD}, }; for (auto &elem : stdtextInit) { cs_text.LoadString(elem.si); iItem = m_pLC_Selected->InsertItem(++iItem, cs_text); m_pLC_Selected->SetItemData(iItem, elem.ii | NORMALFIELD); m_bsAllowedFields.set(elem.ii); m_bsDefaultSelectedFields.set(elem.ii); } } m_pLC_List->SortItems(AdvCompareFunc, NULL); m_pLC_Selected->SortItems(AdvCompareFunc, NULL); if (m_iIndex == FIND) { GetDlgItem(IDC_TREATWHITESPACEASEMPTY)->EnableWindow(FALSE); GetDlgItem(IDC_TREATWHITESPACEASEMPTY)->ShowWindow(SW_HIDE); // Only add attachment fields for V4 and later if (m_current_version >= PWSfile::V40) { const CString cs_att = L" (" + CString(MAKEINTRESOURCE(IDS_ATTACHMENTS)) + L")"; const struct { int si; int ii; } attInit[] = { {IDS_FILETITLE, CItemAtt::TITLE}, {IDS_FILENAME, CItemAtt::FILENAME}, {IDS_FILEPATH, CItemAtt::FILEPATH}, {IDS_FILEMEDIATYPE, CItemAtt::MEDIATYPE}, }; for (auto &elem : attInit) { cs_text.LoadString(elem.si); cs_text += cs_att; iItem = m_pLC_List->InsertItem(++iItem, cs_text); m_pLC_List->SetItemData(iItem, elem.ii | NORMALFIELD); m_bsAttAllowedFields.set(elem.ii - CItemAtt::START); } } else { // Don't allow any m_bsAttAllowedFields.reset(); } } if (m_bsFields.count() != 0 && m_bsFields.count() != m_bsFields.size() && m_bsAttFields.count() != 0) { Set(m_bsFields); } if (m_bsAttFields.count() != 0 && m_bsAttFields.count() != m_bsAttFields.size()) { SetAtt(m_bsAttFields); } m_pToolTipCtrl = new CToolTipCtrl; if (!m_pToolTipCtrl->Create(this, TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOPREFIX)) { pws_os::Trace(L"Unable To create Advanced Dialog ToolTip\n"); delete m_pToolTipCtrl; m_pToolTipCtrl = NULL; return TRUE; } // Tooltips EnableToolTips(); // Activate the tooltip control. m_pToolTipCtrl->Activate(TRUE); m_pToolTipCtrl->SetMaxTipWidth(300); // Quadruple the time to allow reading by user int iTime = m_pToolTipCtrl->GetDelayTime(TTDT_AUTOPOP); m_pToolTipCtrl->SetDelayTime(TTDT_AUTOPOP, 4 * iTime); // Set the tooltip // Note naming convention: string IDS_xxx corresponds to control IDC_xxx CString cs_ToolTip; cs_ToolTip.LoadString(IDS_ADVANCED_SELECTSOME); m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_SELECTSOME), cs_ToolTip); cs_ToolTip.LoadString(IDS_ADVANCED_SELECTALL); m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_SELECTALL), cs_ToolTip); cs_ToolTip.LoadString(IDS_ADVANCED_DESELECTSOME); m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_DESELECTSOME), cs_ToolTip); cs_ToolTip.LoadString(IDS_ADVANCED_DESELECTALL); m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_DESELECTALL), cs_ToolTip); return TRUE; }
void CBaseRecordsDlg::SetFilters(BOOL bSaveSelection) { CFlashRecord* pRecord; CVendorRecord* pVendor; CComboBox* pComboVendor = (CComboBox*)GetDlgItem(IDC_FILTER_VENDOR); CComboBox* pComboTotalSize = (CComboBox*)GetDlgItem(IDC_FILTER_TOTAL_SIZE); CComboBox* pComboPageSize = (CComboBox*)GetDlgItem(IDC_FILTER_PAGE_SIZE); CComboBox* pComboBus = (CComboBox*)GetDlgItem(IDC_FILTER_BUS); CComboBox* pComboCS = (CComboBox*)GetDlgItem(IDC_FILTER_CS); CString strVendor; CString strTotalSize; CString strPageSize; CString strBus; CString strCS; CString strTemp; int nInd; if (bSaveSelection) { pComboVendor->GetLBText(pComboVendor->GetCurSel(), strVendor); pComboTotalSize->GetLBText(pComboTotalSize->GetCurSel(), strTotalSize); pComboPageSize->GetLBText(pComboPageSize->GetCurSel(), strPageSize); pComboBus->GetLBText(pComboBus->GetCurSel(), strBus); pComboCS->GetLBText(pComboCS->GetCurSel(), strCS); } pComboVendor->ResetContent(); pComboVendor->SetItemData(pComboVendor->AddString(NO_FILTER_STR), NO_FILTER_VALUE); pComboTotalSize->ResetContent(); pComboTotalSize->SetItemData(pComboTotalSize->AddString(NO_FILTER_STR), NO_FILTER_VALUE); pComboPageSize->ResetContent(); pComboPageSize->SetItemData(pComboPageSize->AddString(NO_FILTER_STR), NO_FILTER_VALUE); pComboBus->ResetContent(); pComboBus->SetItemData(pComboBus->AddString(NO_FILTER_STR), NO_FILTER_VALUE); pComboCS->ResetContent(); pComboCS->SetItemData(pComboCS->AddString(NO_FILTER_STR), NO_FILTER_VALUE); for (POSITION nPosRecord = m_database.GetRecordHeadPosition(); nPosRecord != NULL; ) { pRecord = m_database.GetRecordNext(nPosRecord); strTemp.Empty(); for (POSITION nPosVendor = m_database.GetVendorHeadPosition(); nPosVendor != NULL; ) { pVendor = m_database.GetVendorNext(nPosVendor); if (pVendor->m_nID != pRecord->m_nVendorID) continue; strTemp = pVendor->m_strVendor; break; } if (CB_ERR == pComboVendor->FindStringExact(-1, strTemp)) { pComboVendor->SetItemData(pComboVendor->AddString(strTemp), pRecord->m_nVendorID); } strTemp = pRecord->GetStringSize(); if (CB_ERR == pComboTotalSize->FindStringExact(-1, strTemp)) { pComboTotalSize->SetItemData(pComboTotalSize->AddString(strTemp), 0); } strTemp = pRecord->GetStringPageSize(); if (CB_ERR == pComboPageSize->FindStringExact(-1, strTemp)) { pComboPageSize->SetItemData(pComboPageSize->AddString(strTemp), pRecord->m_nPageSize); } strTemp = CFlashRecord::GetStringBusWidth(pRecord->m_nBusWidth); if (CB_ERR == pComboBus->FindStringExact(-1, strTemp)) { pComboBus->SetItemData(pComboBus->AddString(strTemp), pRecord->m_nBusWidth); } strTemp.Format(_T("%d CE"), pRecord->m_nCountCS); if (CB_ERR == pComboCS->FindStringExact(-1, strTemp)) { pComboCS->SetItemData(pComboCS->AddString(strTemp), pRecord->m_nCountCS); } } nInd = pComboVendor->FindStringExact(-1, strVendor); if (CB_ERR == nInd) nInd = 0; m_nFilterVendor = pComboVendor->GetItemData(nInd); pComboVendor->SetCurSel(nInd); nInd = pComboTotalSize->FindStringExact(-1, strTotalSize); if (CB_ERR == nInd) nInd = 0; pComboTotalSize->GetLBText(nInd, m_strFilterTotalSize); pComboTotalSize->SetCurSel(nInd); nInd = pComboPageSize->FindStringExact(-1, strPageSize); if (CB_ERR == nInd) nInd = 0; m_nFilterPageSize = pComboPageSize->GetItemData(nInd); pComboPageSize->SetCurSel(nInd); nInd = pComboBus->FindStringExact(-1, strBus); if (CB_ERR == nInd) nInd = 0; m_nFilterBus = pComboBus->GetItemData(nInd); pComboBus->SetCurSel(nInd); nInd = pComboCS->FindStringExact(-1, strCS); if (CB_ERR == nInd) nInd = 0; m_nFilterCS = pComboCS->GetItemData(nInd); pComboCS->SetCurSel(nInd); }
int CXTPCalendarEventRecurrenceDlg::_AddLocaleString(CComboBox& wndCB, LCTYPE lcidStr, DWORD_PTR dwItemData) { int nIndex = wndCB.AddString(CXTPCalendarUtils::GetLocaleString(lcidStr, 255)); wndCB.SetItemData(nIndex, dwItemData); return nIndex; }
inline void addstring_datatype( CComboBox& cb, DWORD dwItem, LPCTSTR strItem ) { long i = cb.AddString( strItem ); cb.SetItemData( i, dwItem ); }