Click here to Skip to main content
15,920,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Building question Pin
Cedric Moonen15-Jun-05 3:24
Cedric Moonen15-Jun-05 3:24 
GeneralRe: Building question Pin
normanS15-Jun-05 3:53
normanS15-Jun-05 3:53 
GeneralRe: Building question Pin
Lampros Giampouras15-Jun-05 14:09
Lampros Giampouras15-Jun-05 14:09 
GeneralRe: Building question Pin
squidev15-Jun-05 15:46
squidev15-Jun-05 15:46 
GeneralRe: Building question Pin
Lampros Giampouras16-Jun-05 9:11
Lampros Giampouras16-Jun-05 9:11 
Generalweird errors Pin
Anonymous15-Jun-05 2:29
Anonymous15-Jun-05 2:29 
GeneralRe: weird errors Pin
Blake Miller15-Jun-05 4:44
Blake Miller15-Jun-05 4:44 
GeneralRe: weird errors Pin
David Crow15-Jun-05 5:40
David Crow15-Jun-05 5:40 
Using the Office XP Professional installation as a guide, I put this together (extraneous code has been removed):

class CMyDlg : public CDialog
{
    CButton m_btnOK;
    CEdit   m_ebKey5;
    CEdit   m_ebKey4;
    CEdit   m_ebKey3;
    CEdit   m_ebKey2;
    CEdit   m_ebKey1;
	
    afx_msg void OnChangeEdit1();
    afx_msg void OnChangeEdit2();
    afx_msg void OnChangeEdit3();
    afx_msg void OnChangeEdit4();
    afx_msg void OnChangeEdit5();
 
    void EnableOKButton( void );
};
 
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CMyDlg)
    DDX_Control(pDX, IDOK, m_btnOK);
    DDX_Control(pDX, IDC_EDIT5, m_ebKey5);
    DDX_Control(pDX, IDC_EDIT4, m_ebKey4);
    DDX_Control(pDX, IDC_EDIT3, m_ebKey3);
    DDX_Control(pDX, IDC_EDIT2, m_ebKey2);
    DDX_Control(pDX, IDC_EDIT1, m_ebKey1);
    //}}AFX_DATA_MAP
}
 
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
    //{{AFX_MSG_MAP(CMyDlg)
    ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
    ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
    ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
    ON_EN_CHANGE(IDC_EDIT4, OnChangeEdit4)
    ON_EN_CHANGE(IDC_EDIT5, OnChangeEdit5)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()
 
BOOL CMyDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
 
    m_ebKey1.SetLimitText(5);
    m_ebKey2.SetLimitText(5);
    m_ebKey3.SetLimitText(5);
    m_ebKey4.SetLimitText(5);
    m_ebKey5.SetLimitText(5);
 
    return TRUE;  // return TRUE  unless you set the focus to a control
}
 
void CMyDlg::OnChangeEdit1() 
{
    if (m_ebKey1.GetWindowTextLength() == 5)
        m_ebKey2.SetFocus();
 
    EnableOKButton();
}
...
void CMyDlg::OnChangeEdit4() 
{	
    if (m_ebKey4.GetWindowTextLength() == 5)
        m_ebKey5.SetFocus();
 
    EnableOKButton();
}
 
void CMyDlg::OnChangeEdit5() 
{
    // no SetFocus() required
 
    EnableOKButton();
}
 
void CMyDlg::EnableOKButton( void )
{
    bool    bEnable = true;
 
    bEnable &= (m_ebKey1.GetWindowTextLength() == 5);
    bEnable &= (m_ebKey2.GetWindowTextLength() == 5);
    bEnable &= (m_ebKey3.GetWindowTextLength() == 5);
    bEnable &= (m_ebKey4.GetWindowTextLength() == 5);
    bEnable &= (m_ebKey5.GetWindowTextLength() == 5);
 
    m_btnOK.EnableWindow(bEnable);
}
I did not do anything for the copy/paste requirement.


"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown


GeneralCListCtrl Class Help! Pin
mahanagarjuna15-Jun-05 2:12
mahanagarjuna15-Jun-05 2:12 
GeneralMessage for ListView Pin
Duy Nghia15-Jun-05 1:27
Duy Nghia15-Jun-05 1:27 
GeneralRe: Message for ListView Pin
David Crow15-Jun-05 4:53
David Crow15-Jun-05 4:53 
GeneralRe: Message for ListView Pin
Duy Nghia15-Jun-05 15:35
Duy Nghia15-Jun-05 15:35 
GeneralRe: Message for ListView Pin
David Crow16-Jun-05 2:47
David Crow16-Jun-05 2:47 
GeneralCreating Multiple Document Interface using a CRichEditCtrl Pin
dittygrail15-Jun-05 1:17
dittygrail15-Jun-05 1:17 
GeneralOwner Draw List Box & GetText() Pin
Jon Hulatt15-Jun-05 1:14
Jon Hulatt15-Jun-05 1:14 
GeneralRe: Owner Draw List Box & GetText() Pin
Terence Russell1-Jun-23 8:19
Terence Russell1-Jun-23 8:19 
GeneralTime In Microseconds Pin
sweep12315-Jun-05 1:08
sweep12315-Jun-05 1:08 
Questiongetting the upper left pixel of HBITMAP? Pin
ThinkingPrometheus15-Jun-05 0:30
ThinkingPrometheus15-Jun-05 0:30 
AnswerRe: getting the upper left pixel of HBITMAP? Pin
ThatsAlok15-Jun-05 0:49
ThatsAlok15-Jun-05 0:49 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
ThinkingPrometheus15-Jun-05 3:38
ThinkingPrometheus15-Jun-05 3:38 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
Bob Stanneveld15-Jun-05 4:29
Bob Stanneveld15-Jun-05 4:29 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
ThinkingPrometheus15-Jun-05 5:49
ThinkingPrometheus15-Jun-05 5:49 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
Bob Stanneveld15-Jun-05 5:54
Bob Stanneveld15-Jun-05 5:54 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
ThinkingPrometheus15-Jun-05 21:40
ThinkingPrometheus15-Jun-05 21:40 
GeneralRe: getting the upper left pixel of HBITMAP? Pin
Bob Stanneveld15-Jun-05 21:51
Bob Stanneveld15-Jun-05 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.