BOOL COptionsMisc::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 } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(1, 60000); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); InitToolTip(); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx AddTool(IDC_MAINTAINDATETIMESTAMPS, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATION, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATION, IDS_OTHEREDITORLOCATION); ActivateToolTip(); return TRUE; }
BOOL COptionsMisc::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 } // Database preferences - can't change in R/O mode of if no DB is open if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) { GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_DEFAUTOTYPE)->EnableWindow(FALSE); GetDlgItem(IDC_DB_DEF_AUTOTYPE_TEXT)->EnableWindow(FALSE); GetDlgItem(IDC_MAINTAINDATETIMESTAMPS)->EnableWindow(FALSE); GetDlgItem(IDC_USEDEFUSER)->EnableWindow(FALSE); } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(M_prefminAutotypeDelay(), M_prefmaxAutotypeDelay()); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); m_Help3.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_MAINTAINDATETIMESTAMPSHELP, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATIONHELP, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATIONHELP, IDS_OTHEREDITORLOCATION); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); m_Help3.EnableWindow(FALSE); m_Help3.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control }
void CFormatBar::SetFormat(UINT* pIds, int nIds) { // return; BOOL fShowedTypefaceBox = FALSE; BOOL fShowedSizeBox = FALSE; BOOL fShowedRotateBox = FALSE; /* Allocate memory for our buttons. */ if (SetButtons(NULL, nIds)) { /* Now go through and set all buttons. */ UINT* pId = pIds; for (int nId = 0; nId < nIds; nId++, pId++) { switch (*pId) { case ID_SEPARATOR: { // width of separator includes 2 pixel overlap SetButtonInfo(nId, *pId, TBBS_SEPARATOR, m_cxDefaultGap + 2); break; } case IDC_TEXT_TYPEFACE: { // We want the typeface combo box here. SetupCombo(nId, *pId, m_nFontAverageWidth*18, m_TypefaceBox); fShowedTypefaceBox = TRUE; break; } case IDC_TEXT_SIZE: { // We want the point size combo box here. SetupCombo(nId, *pId, m_nFontAverageWidth*10, m_SizeBox); fShowedSizeBox = TRUE; break; } case IDC_ROTATE: { // We want the point size combo box here. SetupCombo(nId, *pId, m_nFontAverageWidth*10, m_RotateBox); fShowedRotateBox = TRUE; break; } #ifdef WIN32 case TID_HIDDEN_CONTROL: { /* Our special hidden control. */ SetButtonInfo(nId, *pId, TBBS_BUTTON, -1); break; } #endif default: { /* A regular button. */ // SetButtonInfo(nId, *pId, TBBS_BUTTON, IndexFromId(*pId)); break; } } } } /* // Make sure everything redraws. */ CRect crWindow; GetClientRect(&crWindow); InvalidateRect(crWindow); /* // Hide the controls we aren't using. */ if (!fShowedTypefaceBox) { HideCombo(m_TypefaceBox); } if (!fShowedSizeBox) { HideCombo(m_SizeBox); } if (!fShowedRotateBox) { HideCombo(m_RotateBox); } SendMessage(WM_IDLEUPDATECMDUI, TRUE, 0L); }