7.1 例题(2) (2)IDD DIALOG ADD IDC STATIC Group Box Caption:设置添加操作 IDC RADIO ALL Radio Button Caption:全部元素,(roup:选中 IDC RADIO ELEMENT Radio Button Caption:指定元素 IDC STATIC Static Text Caption:数组下标 IDC EDITⅤALUE Edit box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量: IDC RADIO ALI int m radio IDC EDIT VALUE Int m nIndex
例题(2) 7.1 (2) IDD_DIALOG_ADD IDC_STATIC Group Box Caption:设置添加操作 IDC_RADIO_ALL Radio Button Caption:全部元素,Group:选中 IDC_RADIO_ELEMENT Radio Button Caption:指定元素 IDC_STATIC StaticText Caption:数组下标 IDC_EDIT_VALUE Edit Box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量: IDC_RADIO_ALL int m_nRidio IDC_EDIT_VALUE int m_nIndex
例题(3) 7.1 3.为对话框 IDD DIALOG ADD添加响应函数 BOOL CDIgAdd: OnI Dialogo CDialog: OnlnitDialogo M/ TODO: Add extra initialization here ((CButton")GetDIgltem(IDC RADIO SED)->Setcheck(1) return TRUE; / return TRUE unless you set the focus to a control l EXCEPTION: OCX Property Pages should return FALSE void CDIgAdd On Radio Seto //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(true);
例题(3) 7.1 3.为对话框IDD_DIALOG_ADD添加响应函数 BOOL CDlgAdd::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC_RADIO_SET))->SetCheck(1); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgAdd::OnRadioSet() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); }
例题(3) 7.1 void CDIgAdd: OnRadio Addo //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT_ INDEX)->EnableWindow(false); void cCDIgAdd: On Radiolnserto //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(true) void CDIgAdd: OnOKo /TODO: Add extra validation here Update Data(true); CDialog: OnOKo
例题(3) 7.1 void CDlgAdd::OnRadioAdd() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); } void CDlgAdd::OnRadioInsert() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); } void CDlgAdd::OnOK() { // TODO: Add extra validation here UpdateData(true); CDialog::OnOK(); }
例题(4) 7.1 4.为对话框 IDD DIALOG DELETE添加响应函数 BOOL CDlgDelete: OnInitDialogo CDialog: OnlnitDialogo // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC RADIO_ ALL)->Set check(1) GetDlgltem(IDC EDIT INDEX)->EnableWindow(false) return TRUE; /return TRUE unless you set the focus to a control //EXCEPTION: OCX Property Pages should return FALSE void CDlgDelete: OnRadioElemento //TODO: Add your control notification handler code here GetDlgltem(IDC EDIT INDEX)->Enable Window(true)
例题(4) 7.1 BOOL CDlgDelete::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC_RADIO_ALL))->SetCheck(1); GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgDelete::OnRadioElement() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); } 4.为对话框IDD_DIALOG_DELETE添加响应函数
7.1 例题(4) void CDigDelete: OnRadIoAlo //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(false) void CDlgDelete: OnOKo l/ TODO: Add extra validation here Update Data(true) CDialog: OnOKo
例题(4) 7.1 void CDlgDelete::OnRadioAll() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); } void CDlgDelete::OnOK() { // TODO: Add extra validation here UpdateData(true); CDialog::OnOK(); }