/* #FN# Sets up the state of the wizard controls */ void /* #AS# Nothing */ CWizardDlg:: SetWizardState() { CButton *pBack = (CButton *)GetDlgItem( IDC_WIZARD_BACK ); CButton *pNext = (CButton *)GetDlgItem( IDC_WIZARD_NEXT ); CButton *pFinish = (CButton *)GetDlgItem( IDC_WIZARD_FINISH ); BOOL bFirst = (BOOL)(!m_nCurrentIndex); BOOL bLast = (BOOL)(m_nCurrentIndex == m_arrPages.GetUpperBound()); ASSERT(NULL != pBack && NULL != pNext && NULL != pFinish); pBack->EnableWindow( !bFirst ); pNext->EnableWindow( !bLast ); if( bLast ) { SetDefID( IDC_WIZARD_FINISH ); GotoDlgCtrl( pFinish ); } else { SetDefID( IDC_WIZARD_NEXT ); if( bFirst ) GotoDlgCtrl( pNext ); } /* Set wizard dialog title */ m_strTitle.Format( IDS_WIZARD_TITLE, m_nCurrentIndex + 1, m_arrPages.GetUpperBound() != -1 ? m_arrPages.GetUpperBound() + 1 : 1 ); SetWindowText( m_strTitle ); } /* #OF# CWizardDlg::SetWizardState */
void RenOutFile::OnChangeRenFileName() { CString nfn; m_FileName.GetWindowText(nfn); if (FExist(*pathPointer + nfn)) { m_OWrite.Enable(); m_Rename.Disable(); SetDefID(m_OWrite.GetDlgCtrlID()); } else { m_OWrite.Disable(); m_Rename.Enable(); SetDefID(m_Rename.GetDlgCtrlID()); } if (nfn.CompareNoCase(origValue) == 0) c_ResetButton.Disable(); else c_ResetButton.Enable(); }
void CFormatTabDlg::UpdateButtons() { UpdateButton(m_buttonClearAll, m_nCount > 0); BOOL bHasText = (m_comboBox.GetWindowTextLength() > 0); UpdateButton(m_buttonSet, bHasText); UpdateButton(m_buttonClear, bHasText); WORD wID = LOWORD(GetDefID()); if (bHasText && wID != IDC_BUTTON_SET) SetDefID(IDC_BUTTON_SET); else if (!bHasText && wID != IDOK) SetDefID(IDOK); }
BOOL CGotoDlg::OnInitDialog() { CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd()); CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() ); CWSDialog::OnInitDialog(); CWSUIExtras::SetWSDialogWindowText(CWnd::GetSafeHwnd(), Workshare::Products::WS_PROD_COMPARE); m_btnGoto.SubclassDlgItem( IDGOTO, this ); m_btnClose.SubclassDlgItem( IDCLOSE, this ); if (pFrame && pFrame->GetCompositeView()) { CRect rcView; pFrame->GetCompositeView()->GetWindowRect(rcView); SetWindowPos(&wndTop, rcView.left+10, rcView.top+10, 0, 0, SWP_NOSIZE); } // Setup the help link. m_StaticHyperLinkHelp.SubclassDlgItem(IDC_HELPLINK, this); m_StaticHyperLinkHelp.m_iHelpID = GetHelpID(); SetDefID(IDGOTO); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL PreferencesDialog::OnInitDialog() { CDialog::OnInitDialog(); CWnd* item = GetDlgItem(IDOK); SetDefID(IDOK); if (item) ((CButton*)item)->SetButtonStyle(BS_DEFPUSHBUTTON); item = GetDlgItem(IDCANCEL); if (item) ((CButton*)item)->SetButtonStyle(0); GetPreferencesInfo(&info); CRect rect; // initialize buttons textColorWnd = GetDlgItem(ID_TEXTCOLOR); highlightTextColorWnd = GetDlgItem(ID_HIGHLIGHTTEXTCOLOR); outputTextColorWnd = GetDlgItem(ID_OUTPUTTEXTCOLOR); hintBackgroundColorWnd = GetDlgItem(ID_HINTBACKGROUNDCOLOR); updateDialog(); return TRUE; }
BOOL CKeyValue::PreTranslateMessage(MSG* pMsg) { CString omStrKey = ""; // check for WM_CHAR message and then check for key pressed. // Stored only alphabatic keys pressed and "*". display the key values if(pMsg->message == WM_CHAR) { omStrKey.Format("Key Pressed : %c",pMsg->wParam); if( ( pMsg->wParam >= 'a' && pMsg->wParam<='z' ) ||( pMsg->wParam >= 'A' && pMsg->wParam<='Z' ) ||( pMsg->wParam >= '0' && pMsg->wParam<='9' ) || pMsg->wParam == defGENERIC_KEY ) { *m_pcKeyVal = static_cast <CHAR> (pMsg->wParam); SetDlgItemText(IDC_STAT_KEY, omStrKey); // Amarnath S , 27.03.2002 // Enable the Ok button if disabled if (!(GetDlgItem( IDOK )->IsWindowEnabled()) && !(GetDlgItem( IDC_CBTN_KEY_APPLY )->IsWindowEnabled())) { GetDlgItem( IDOK )->EnableWindow(TRUE); GetDlgItem( IDC_CBTN_KEY_APPLY )->EnableWindow(TRUE); SetDefID( IDOK ); } } } return CDialog::PreTranslateMessage(pMsg); }
BOOL CreditsDialog::OnInitDialog() { char legalFilePath[MAX_PATH]; strcpy_s(legalFilePath, sizeof(legalFilePath), getCormanLispDirectory()); strcat_s(legalFilePath, sizeof(legalFilePath), "\\documentation\\credits.txt"); DWORD length; mappedFile = MapFile(legalFilePath, &length); char buf[0x6000]; if (mappedFile) memcpy(buf, mappedFile, length); buf[length] = 0; CWnd* item = GetDlgItem(IDC_LEGALTEXT); if (item && mappedFile) item->SetWindowText(buf); CDC* cdc = item->GetDC(); HDC hDC = cdc->m_hDC; CFont* font = theApp.getCourierFont(hDC, 10); item->SetFont(font, TRUE); SelectObject(hDC, *font); item = GetDlgItem(IDOK); if (item) ((CButton*)item)->SetButtonStyle(BS_DEFPUSHBUTTON); SetDefID(IDOK); return FALSE; }
BOOL CGeneralMsgBox::OnInitDialog() { if (!CDialog::OnInitDialog()) return FALSE; SetWindowText(m_strTitle); // Getting the base dialog unit used in pixel <-> d.u. conversion CRect rc(0, 0, CX_DLGUNIT_BASE, CY_DLGUNIT_BASE); MapDialogRect(rc); m_dimDlgUnit = rc.Size(); // Creating the nested controls CreateRtfCtrl(); CreateIcon(); CreateBtns(); // Updating the layout - preparing to show UpdateLayout(); // Disabling the ESC key if (m_uiEscCmdId == (UINT)IDC_STATIC) ModifyStyle(WS_SYSMENU, NULL); // Focusing and setting the defaul button if (m_uiDefCmdId != (UINT)IDC_STATIC) { GetDlgItem(m_uiDefCmdId)->SetFocus(); SetDefID(m_uiDefCmdId); return FALSE; } return TRUE; }
BOOL RegistrationDialog::OnInitDialog() { CWnd* item = GetDlgItem(IDOK); if (item) { // item->EnableWindow(FALSE); // disable this } m_name = (CEdit*)GetDlgItem(IDC_EDITNAME); m_organization = (CEdit*)GetDlgItem(IDC_EDITORG); // m_registrationCode = (CEdit*)GetDlgItem(IDC_EDITREGCODE); char namebuf[256]; unsigned long length = 256; GetUserName(namebuf, &length); m_name->SetWindowText(namebuf); GotoDlgCtrl(m_name); SetDefID(IDOK); if (item) ((CButton*)item)->SetButtonStyle(BS_DEFPUSHBUTTON); item = GetDlgItem(IDCANCEL); if (item) ((CButton*)item)->SetButtonStyle(0); RegistrationInfo info; GetRegistrationInfo(&info); /* if (!(info.isRegistered)) { item = GetDlgItem(IDC_DAYSREMAINING); time_t ltime; time_t currTime = time(<ime); int daysRemaining = info.daysRemaining; if (daysRemaining < 0) { char buf[256]; sprintf_s(buf, sizeof(buf), "Sorry, your evaluation time has expired. " "You are %d days past your evaluation period. " "You may use this application, but you will be periodically " "reminded to register your copy.", -daysRemaining); AfxMessageBox(buf); theApp.m_expired = TRUE; theApp.m_lastExpiredScreenTime = GetTickCount(); item->SetWindowText("Expired"); } else { char buf[16]; sprintf_s(buf, sizeof(buf), "%d", daysRemaining); item->SetWindowText(buf); } } */ return FALSE; }
void CDimensionsDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); //need to reset these when the window is hid or shown so that //when the user hits enter it won't hide the dialog -JohnO GotoDlgCtrl( GetDlgItem(ID_APPLY) ); SetDefID(ID_APPLY); UpdateControls(); }
void CFormatTabDlg::OnSelchange() { UpdateButton(m_buttonClearAll, m_nCount > 0); // force these since if the edit control is empty and // an item in the box is clicked on, the edit control will // not be filled in first UpdateButton(m_buttonSet, TRUE); UpdateButton(m_buttonClear, TRUE); WORD wID = LOWORD(GetDefID()); if (wID != IDC_BUTTON_SET) SetDefID(IDC_BUTTON_SET); }
BOOL CElementListDlog::OnInitDialog() { CDialog::OnInitDialog(); if (m_pDoc) { m_oListFilter.ResetContent(); m_oListFilter.SetItemData(m_oListFilter.AddString("All"),-1); m_hDefaultIcon = LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_BOXWALL_ICON)); HICON hIcon; CBaseObject *pTempObject; oImgeList.DeleteImageList(); oImgeList.Create(16,16,ILC_COLOR4,5,m_pDoc->m_oWorld.GetFactoryCount()+2); for (int i = 0; i < m_pDoc->m_oWorld.GetFactoryCount(); i++) { pTempObject = m_pDoc->m_oWorld.GetFactory(i)->New(); hIcon = NULL; if (pTempObject && pTempObject->ShowInInterface()) { hIcon = (HICON)pTempObject->GetIcon(); int iItem = m_oListFilter.AddString(m_pDoc->m_oWorld.GetFactoryName(i)); m_oListFilter.SetItemData(iItem,i); } if (!hIcon) hIcon = m_hDefaultIcon; oImgeList.Add(hIcon); m_pDoc->m_oWorld.GetFactory(i)->Delete(pTempObject); } m_oListFilter.SetCurSel(0); m_oListCtl.SetImageList(&oImgeList,LVSIL_SMALL); OnSelchangeElementFilter(); SetDefID(IDC_ELEMENT_FILTER); } m_bWinUp = true; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptionsDlgSelector::OnInitDialog() { CWSDialog::OnInitDialog(); CWSUIExtras::SetWSDialogWindowText(CWnd::GetSafeHwnd(), Workshare::Products::WS_PROD_COMPARE, L"Compare Documents"); GetDlgItem(IDC_STATIC_MAIN_DIALOG_HEADING)->SetFont(CFont::FromHandle(m_workshareFonts.WorkshareMainInstructionFont())); SubclassButtonsAndSetupImages(); CRect rc; GetDlgItem( IDC_MODIFIED_LOCATION )->GetWindowRect( rc ); ScreenToClient( rc ); m_multiModifiedDlg.Create( MultipleModifiedDialog::IDD, this ); m_multiModifiedDlg.SetWindowPos( &m_btnDoc1, rc.left, rc.top, rc.Width(), rc.Height(), SWP_SHOWWINDOW ); m_multiModifiedDlg.Subclass(); PopulateMostRecentlyUsedList(true); PopulateMostRecentlyUsedList(false); PopulateRenderingSetList(); PopulateComparisonOptions(false); SetupDocumentSelectionControls(); // Automation can leave selector behind client MainWnd. BringWindowToTop(); // Disable Drag and drop while dialog is up CMainFrame* pMainFrame = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd()); if(pMainFrame) { pMainFrame->EnableDragAndDrop(false); } // Setup the help link. m_StaticHyperLinkHelp.SubclassDlgItem(IDC_HELPLINK, this); m_StaticHyperLinkHelp.m_iHelpID = GetHelpID(); SetDefID(IDOK); CheckOkButtonState( ); m_cboDocumentOne.SetFocus(); return FALSE; }
void COptionsDlgSelector::ResetOKAsDefault(bool bAndFocus) { if(GetDefID() != IDOK) { SetDefID(IDOK); if(bAndFocus) m_btnOk.SetFocus(); m_btnOk.Invalidate(); // Otherwise the changes are not all drawn m_StaticHyperLinkHelp.Invalidate(); m_btnCancel.Invalidate(); m_btnDoc1.Invalidate(); m_btnOptions.Invalidate(); m_btnSwap.Invalidate(); m_multiModifiedDlg.Invalidate(); } }
BOOL AboutDialog::OnInitDialog() { CStatic* name = (CStatic*)GetDlgItem(IDC_ABOUTNAME); CStatic* org = (CStatic*)GetDlgItem(IDC_ABOUTORG); CStatic* evalMessage = (CStatic*)GetDlgItem(IDC_EVALMESSAGE); CStatic* daysRemaining = (CStatic*)GetDlgItem(IDC_DAYSREMAINING); CStatic* version = (CStatic*)GetDlgItem(IDC_REGVERSION); RegistrationInfo info; RegistrationDialog::GetRegistrationInfo(&info); char* versionCaption = getVersionCaption(); if (versionCaption) version->SetWindowText(versionCaption); if (info.isRegistered) { name->SetWindowText(info.name); org->SetWindowText(info.organization); evalMessage->ShowWindow(SW_HIDE); daysRemaining->ShowWindow(SW_HIDE); } else { name->SetWindowText("Evaluation Copy"); org->SetWindowText(""); int remaining = info.daysRemaining; if (remaining < 0) { daysRemaining->SetWindowText("Expired"); theApp.m_expired = TRUE; } else { char buf[16]; sprintf_s(buf, sizeof(buf), "%d", remaining); daysRemaining->SetWindowText(buf); } } CWnd* item = GetDlgItem(IDOK); if (item) ((CButton*)item)->SetButtonStyle(BS_DEFPUSHBUTTON); SetDefID(IDOK); return FALSE; }
BOOL CXTPTaskDialogFrame::OnInitDialog() { BOOL bResult = CXTPTaskDialogClient::OnInitDialog(); int nDefaultButton = m_pConfig->nDefaultButton; if (nDefaultButton == 0) { if (m_arrLinkButtons.GetSize() > 0) { nDefaultButton = m_arrLinkButtons[0]->GetDlgCtrlID(); } else if (m_arrCommandButtons.GetSize() > 0) { nDefaultButton = m_arrCommandButtons[0]->GetDlgCtrlID(); } } CWnd* pWnd = nDefaultButton > 0 ? GetDlgItem(nDefaultButton) : NULL; if (pWnd) { SetDefID(nDefaultButton); } if (pWnd && m_wndInputBox.GetSafeHwnd() == 0) { PostMessage(WM_NEXTDLGCTL, (WPARAM)pWnd->GetSafeHwnd(), TRUE); } m_dwTickCount = GetTickCount(); if (m_pConfig->dwFlags & TDF_CALLBACK_TIMER) { SetTimer(1, m_dwCallbackInterval, NULL); } return bResult; }
BOOL CGotoDlg::PreTranslateMessage(MSG* pMsg) { if(pMsg->message==WM_KEYDOWN) { if(pMsg->wParam==VK_ESCAPE) { OnClose(); return TRUE; } if(pMsg->wParam==VK_RETURN) { OnGoto(); return TRUE; } SetDefID(IDGOTO); m_btnGoto.Invalidate(); // Otherwise the DefID change is not drawn m_btnClose.Invalidate(); m_StaticHyperLinkHelp.Invalidate(); } return CWSDialog::PreTranslateMessage(pMsg); }
BOOL UpdateCheckerDlg::OnInitDialog() { BOOL ret = __super::OnInitDialog(); switch (m_updateStatus) { case UPDATER_UPDATE_AVAILABLE: case UPDATER_UPDATE_AVAILABLE_IGNORED: m_icon.SetIcon(LoadIcon(nullptr, IDI_QUESTION)); break; case UPDATER_LATEST_STABLE: case UPDATER_NEWER_VERSION: case UPDATER_ERROR: { m_icon.SetIcon(LoadIcon(nullptr, (m_updateStatus == UPDATER_ERROR) ? IDI_WARNING : IDI_INFORMATION)); m_dlButton.ShowWindow(SW_HIDE); m_laterButton.ShowWindow(SW_HIDE); m_ignoreButton.SetWindowText(ResStr(IDS_UPDATE_CLOSE)); CRect buttonRect, windowRect; m_ignoreButton.GetWindowRect(&buttonRect); ScreenToClient(&buttonRect); // Reduce the button width buttonRect.left += 30; // Center the button GetWindowRect(&windowRect); buttonRect.MoveToX((windowRect.Width() - buttonRect.Width()) / 2); m_ignoreButton.MoveWindow(&buttonRect); // Change the default button SetDefID(IDC_UPDATE_IGNORE_BUTTON); ret = FALSE; // Focus has been set explicitly } break; default: ASSERT(0); // should never happen } return ret; }
//////////////////////////////////////// // // 设置回车时默认的ID // void newproject::OnSetfocusEDITengcode() { SetDefID(IDC_EDIT_eng_code); }
void CFindTagDlg::OnSetfocusFindtagcombo2() { SetDefID(IDC_FIND2); }
void newproject::OnSetfocusEDITengin() { SetDefID(IDC_EDIT_engin); }