mfc_Dlg_add - 8BitsCoding/RobotMentor GitHub Wiki
μλ‘μ΄ λνμμλ₯Ό μΆκ°ν λ Visible μμ±μ νμ Trueλ‘ λ³κ²½!
Modal Dlg μμ±
κΈ°λ³Έ λνμμμμ μ«μλ₯Ό μ λ ₯ ν 'λνμμμ€ν'λ²νΌμ λλ₯΄λ©΄ μλ‘μ΄ λνμμκ° μ΄λ¦¬λ©΄μ μ λ ₯ λ°μ μ«μλ₯Ό μ μ
μλ‘μ΄ λνμμμμ μ«μλ₯Ό λ³κ²½ ν 'νμΈ'λ²νΌμ λλ₯΄λ©΄ κΈ°μ‘΄ λνμμμ λ³κ²½ν μ«μκ° μ μ©λ¨
μλ‘μ΄ λνμμμμ 'μ’ λ£'λ²νΌμ λλ₯΄λ©΄ κΈ°μ‘΄ λνμμμ 0 μ μ
μλ‘μ΄ λνμμλ₯Ό 리μμ€ νμκΈ°μμ μμ± ν ν΄λμ€λ₯Ό λ§λ λ€(λ€μ΄μΌλ‘κ·Έλ₯Ό λλΈν΄λ¦νλ©΄ μμ±λ¨)
// newDlg.h
private:
int m_num;
public:
void SetNum(int a_num) {
m_num = a_num;
}
int GetNum() {
return m_num;
}
virtual BOOL OnInitDialog();
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedExitBtn();
BOOL newDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: μ¬κΈ°μ μΆκ° μ΄κΈ°ν μμ
μ μΆκ°ν©λλ€.
SetDlgItemInt(IDC_CH_NUM_EDIT, m_num);
return TRUE; // return TRUE unless you set the focus to a control
// μμΈ: OCX μμ± νμ΄μ§λ FALSEλ₯Ό λ°νν΄μΌ ν©λλ€.
}
void newDlg::OnBnClickedOk()
{
m_num = GetDlgItemInt(IDC_CH_NUM_EDIT);
CDialogEx::OnOK();
}
void newDlg::OnBnClickedExitBtn()
{
EndDialog(20);
}
#include "newDlg.h"
void CMFCApplication1Dlg::OnBnClickedShowdlgBtn()
{
int num = GetDlgItemInt(IDC_PR_NUM_EDIT);
newDlg ins_dlg;
// μ νλνμμ μ€ν
ins_dlg.SetNum(num);
int result = ins_dlg.DoModal();
if (IDOK == result) {
SetDlgItemInt(IDC_PR_NUM_EDIT, ins_dlg.GetNum());
}
else if (20 == result) {
SetDlgItemInt(IDC_PR_NUM_EDIT, 0);
}
}