void CTaskDialog::OnClickVerification(BOOL bState, BOOL bFocus) { if (!::IsWindow(GetDlgItem(IDC_CHECK))) return ; CheckDlgButton(IDC_CHECK, (bState ? BST_CHECKED : BST_UNCHECKED)); if (bFocus) SetControlFocus(IDC_CHECK); }
void CTaskDialog::LayoutWindow(void) { // customize post-creation window styles EnableSystemClose(HasFlag(TDF_ALLOW_DIALOG_CANCELLATION)); // create and position controls GenerateControlIDs(); LayoutControls(); SetFontControls(); SetZOrderControls(); // update various graphical items UpdateMainIcon(MainIcon()); UpdateWindowTitle(WindowTitle()); UpdateFooterIcon(FooterIcon()); // set the keyboard focus to the default button // and select the default radio button SetControlFocus(config_.iDefaultButton); if (!HasFlag(TDF_NO_DEFAULT_RADIO_BUTTON) && config_.nDefaultRadioButton != 0) CheckDlgButton(config_.nDefaultRadioButton, BST_CHECKED); // position dialog if (HasFlag(TDF_POSITION_RELATIVE_TO_WINDOW)) CenterWindow(Parent()); else CenterWindow(::GetDesktopWindow()); if (HasFlag(TDF_CALLBACK_TIMER)) CreateCallbackTimer(); Callback(TDN_DIALOG_CONSTRUCTED); }
// 设置控件焦点 BOOL CControlBase::OnFocus(BOOL bFocus) { return SetControlFocus(bFocus); }