BOOL CoptimizerDlg::OnInitDialog() { CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM); CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET); CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); CString buf; CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE); CheckRadioButton(IDC_RADIO_PRESET, IDC_RADIO_CUSTOM, IDC_RADIO_PRESET); Slider->SetRange(1000, 10000); Slider->SetTicFreq(1000); CBox->ResetContent(); for(int i = 0; i < NUMSTRINGS; i++) { buf.LoadString(IDS_STRING1 + i); CBox->AddString(buf); } CBox->SetCurSel(2); SetSlider(Slider, 2); ProgressBar->SetRange(0, 100); return TRUE; }
BOOL COptionsSecurity::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); for (int i = 0; i < 2; i++) { m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS); m_chkbox[i].ResetBkgColour();//Use current window's background } OnLockOnIdleTimeout(); CSpinButtonCtrl *pspin; pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_IDLESPIN); pspin->SetBuddy(GetDlgItem(IDC_IDLE_TIMEOUT)); pspin->SetRange(1, 120); pspin->SetBase(10); pspin->SetPos(m_IdleTimeOut); CSliderCtrl *pslider = (CSliderCtrl *)GetDlgItem(IDC_HASHITERSLIDER); pslider->SetRange(MinHIslider, MaxHIslider); pslider->SetTicFreq(1); pslider->SetPos(m_HashIterSliderValue); return TRUE; }
BOOL COptionsDlg::OnInitDialog() { CPropertyPage::OnInitDialog(); CSliderCtrl *pSampleSlider = (CSliderCtrl*)GetDlgItem(IDC_SAMPLE_SLIDER); ASSERT(pSampleSlider != NULL); pSampleSlider->SetRange(0, ELEMENTS(SampleIntervals) - 1); // Milliseconds pSampleSlider->SetTicFreq(1); pSampleSlider->SetPageSize(1); pSampleSlider->SetLineSize(1); int nPos = 0; for (int i = 0; i < ELEMENTS(SampleIntervals); i++) { if ((UINT)g_nSampleRate >= SampleIntervals[i]) nPos = i; } pSampleSlider->SetPos(nPos); CSliderCtrl *pWindowSlider = (CSliderCtrl*)GetDlgItem(IDC_AVERAGE_SLIDER); ASSERT(pWindowSlider != NULL); pWindowSlider->SetRange(1, (MAX_SAMPLES - 1) / AVERAGING_MULTIPLIER); // Seconds pWindowSlider->SetTicFreq(1); pWindowSlider->SetPageSize(1); pWindowSlider->SetLineSize(1); pWindowSlider->SetPos(g_nAveragingWindow / AVERAGING_MULTIPLIER); int nID; switch (g_MonitorMode) { case MONITOR_DUN : nID = IDC_USE_DUN; break; case MONITOR_ADAPTER: nID = IDC_MONITOR_ADAPTER; break; case MONITOR_ALL : nID = IDC_USE_SNMP; break; default : ASSERT(false); break; } CheckRadioButton(IDC_USE_SNMP, IDC_MONITOR_ADAPTER, nID); m_Interfaces.EnableWindow(g_MonitorMode == MONITOR_ADAPTER); UpdateDlg(); // Return TRUE unless you set the focus to a control // Exception: OCX Property Pages should return FALSE return TRUE; }
void XDlgBarTimeline::UpdateSlider() { CSliderCtrl *pSlider = (CSliderCtrl *)GetDlgItem( IDC_SLIDER_SPEED ); if( pSlider ) { pSlider->SetRange( 10, 100 ); pSlider->SetPos( (int)(SPROBJ->GetSpeedCurrentAction() * 100) ); pSlider->SetTicFreq( 5 ); TCHAR szBuff[16]; _stprintf_s( szBuff, _T("%1.2f"), SPROBJ->GetSpeedCurrentAction() ); GetDlgItem( IDC_TEXT_SPEED )->SetWindowText( szBuff ); } }
BOOL CFillProp::OnInitDialog() { CButton * pBtn = (CButton *)GetDlgItem(IDC_CHECK1); ASSERT(pBtn != NULL); pBtn->SetCheck(m_bFill); m_ctrlColor.SubclassDlgItem(IDC_COLOR,this); CSliderCtrl *pCtrlRed = (CSliderCtrl *)GetDlgItem(IDC_SLIDER1); ASSERT(pCtrlRed != NULL); pCtrlRed->SetRange(0,255); pCtrlRed->SetTicFreq(64); pCtrlRed->SetLineSize(1); pCtrlRed->SetPageSize(64); CSliderCtrl *pCtrlGreen = (CSliderCtrl *)GetDlgItem(IDC_SLIDER2); ASSERT(pCtrlGreen != NULL); pCtrlGreen->SetRange(0,255); pCtrlGreen->SetTicFreq(64); pCtrlGreen->SetLineSize(1); pCtrlGreen->SetPageSize(64); CSliderCtrl *pCtrlBlue = (CSliderCtrl *)GetDlgItem(IDC_SLIDER3); ASSERT(pCtrlBlue != NULL); pCtrlBlue->SetRange(0,255); pCtrlBlue->SetTicFreq(64); pCtrlBlue->SetLineSize(1); pCtrlBlue->SetPageSize(64); UpdateColor(); return TRUE; }
void CdynControlDlg::CreatePositionBundle(cJSON *json, int x, int y, int w, int h) { int idx = cJSON_GetObjectItem(json, "id")->valueint; ids.push_back(idx); CString str; char *name = cJSON_GetObjectItem(json, "name")->valuestring; int min = cJSON_GetObjectItem(json, "min")->valueint; int max = cJSON_GetObjectItem(json, "max")->valueint; str.Format(_T("0x%x: %s\n [%d, %d]"), idx, charTotchar(name), min, max); CButton *checkBox = new CButton(); checkBox->Create(str, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE, CRect(x, y, x + CHECK_WIDTH, y + h), this, CHECK_ID_OFFSET + idx); checkBox->SetCheck(BST_CHECKED); CSliderCtrl *slider = new CSliderCtrl(); int width = w - (CHECK_WIDTH + VIEW_WIDTH); int ptx = x + CHECK_WIDTH; slider->Create(WS_CHILD | WS_VISIBLE | BS_TOP, CRect(ptx, y, ptx + width, y + h), this, SLIDER_ID_OFFSET + idx); slider->SetRange(min, max); slider->SetTicFreq(1); int initPos = cJSON_GetObjectItem(json, "init")->valueint; slider->SetPos(initPos); CEdit *edit = new CEdit(); ptx += width; width = VIEW_WIDTH; edit->Create(WS_CHILD | WS_VISIBLE | BS_TOP, CRect(ptx, y, ptx + width, y + 30), this, VIEW_ID_OFFSET + idx); str.Format(_T("%d"), initPos); edit->SetWindowText(str); }
/* #FN# Sets up the state of the dialog controls */ void /* #AS# Nothing */ CTapeDlg:: SetDlgState() { CSliderCtrl *pSlider = (CSliderCtrl *)GetDlgItem( IDC_TAPE_SLIDER ); CFileStatus fsStatus; ASSERT(NULL != pSlider); /* Check if there is the pointed cassette file */ BOOL bTape = _IsPathAvailable( m_szTapeFile ) && CFile::GetStatus( m_szTapeFile, fsStatus ); pSlider->SetRange( 1, cassette_max_block + 1, FALSE ); pSlider->SetTicFreq( (cassette_max_block / 30) + 1 ); pSlider->SetPageSize( (cassette_max_block / 30) + 1 ); pSlider->SetPos( cassette_current_block ); pSlider->EnableWindow( bTape ); SetDlgItemText( IDC_TAPE_FILE, m_szTapeFile ); SetDlgItemText( IDC_TAPE_DESC, m_bCasImage ? cassette_description : (bTape ? m_szLabels[ LABEL_NOCASIMAGE ] : "") ); SetPosInfo( cassette_current_block ); #ifdef WIN_NETWORK_GAMES if( ST_KAILLERA_ACTIVE ) { _RdOnlyEdit( IDC_TAPE_FILE, TRUE ); _EnableCtrl( IDC_TAPE_BROWSE, FALSE ); _EnableCtrl( IDC_TAPE_EJECT, FALSE ); _EnableCtrl( IDC_TAPE_REWIND, FALSE ); _EnableCtrl( IDC_TAPE_SLIDER, FALSE ); } else #endif { _EnableCtrl( IDC_TAPE_EJECT, bTape ); _EnableCtrl( IDC_TAPE_REWIND, bTape ); } } /* #OF# CTapeDlg::SetDlgState */