void CPPgConnection::SetRateSliderTicks(CSliderCtrl& rRate) { rRate.ClearTics(); int iMin = 0, iMax = 0; rRate.GetRange(iMin, iMax); int iDiff = iMax - iMin; if (iDiff > 0) { CRect rc; rRate.GetWindowRect(&rc); if (rc.Width() > 0) { int iTic; int iPixels = rc.Width() / iDiff; if (iPixels >= 6) iTic = 1; else { iTic = 10; while (rc.Width() / (iDiff / iTic) < 8) iTic *= 10; } if (iTic) { for (int i = ((iMin+(iTic-1))/iTic)*iTic; i < iMax; /**/) { rRate.SetTic(i); i += iTic; } } rRate.SetPageSize(iTic); } } }
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; }
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; }
BOOL CConfigDlg::OnInitDialog() { if( !CDialog::OnInitDialog() ) return FALSE; CString tip; tip.LoadString( IDS_INCREASE_TIP ); m_increase.SetToolTipText( &tip ); tip.LoadString( IDS_MINIMIZE_TIP ); m_minimize.SetToolTipText( &tip ); tip.LoadString( IDS_PAUSE_TIP ); m_muteCheck.SetToolTipText( &tip ); tip.LoadString( IDS_ADD_TIP ); m_addButton.SetToolTipText( &tip ); tip.LoadString( IDS_DELETE_TIP ); m_deleteButton.SetToolTipText( &tip ); m_daysBox.SetUseTabOrder(TRUE); GetPlaylists(); FillBoxes(); m_snoozeTime.SetWindowText( _T("1") ); m_snoozeSpin.SetRange( 1, 60 ); CSliderCtrl *secs = (CSliderCtrl*)GetDlgItem( IDC_SECONDS_SLIDER ); secs->SetPageSize( 10 ); secs->SetRangeMin( 10 ); secs->SetRangeMax( 120 ); secs->EnableWindow( false ); SetFocus(); SetForegroundWindow(); GetDlgItem(IDC_PLAYLISTS)->SetFocus(); ((CButton*)GetDlgItem( IDC_SUNDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[0].c_str() ); ((CButton*)GetDlgItem( IDC_MONDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[1].c_str() ); ((CButton*)GetDlgItem( IDC_TUESDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[2].c_str() ); ((CButton*)GetDlgItem( IDC_WEDNESDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[3].c_str() ); ((CButton*)GetDlgItem( IDC_THURSDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[4].c_str() ); ((CButton*)GetDlgItem( IDC_FRIDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[5].c_str() ); ((CButton*)GetDlgItem( IDC_SATURDAY_CHECK ))->SetWindowText( DayInfo::LongDayNames()[6].c_str() ); return TRUE; }
/* #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 */