Click here to Skip to main content
16,016,088 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Lexical matching - wildcard type Pin
Chris Losinger29-Aug-02 6:04
professionalChris Losinger29-Aug-02 6:04 
GeneralEN_CHANGE and CEdit, simple question Pin
ns29-Aug-02 5:46
ns29-Aug-02 5:46 
GeneralRe: EN_CHANGE and CEdit, simple question Pin
Tomasz Sowinski29-Aug-02 5:49
Tomasz Sowinski29-Aug-02 5:49 
GeneralRe: EN_CHANGE and CEdit, simple question Pin
ns29-Aug-02 5:58
ns29-Aug-02 5:58 
GeneralRe: EN_CHANGE and CEdit, simple question Pin
Tomasz Sowinski29-Aug-02 6:07
Tomasz Sowinski29-Aug-02 6:07 
GeneralRe: EN_CHANGE and CEdit, simple question Pin
Roger Allen29-Aug-02 5:56
Roger Allen29-Aug-02 5:56 
GeneralVery cool! Pin
ns29-Aug-02 6:03
ns29-Aug-02 6:03 
GeneralRe: EN_CHANGE and CEdit, simple question Pin
Sayan Mukherjee29-Aug-02 6:22
Sayan Mukherjee29-Aug-02 6:22 
Hi,

Please find below a possible way to do it using MFC. It is in your lines
of thought and EN_CHANGE does it.

When the application starts the button will be disabled. As you type in the
edit box or delete text EN_CHANGE fires. Keep on measuring the length of the
string.

Code follows:
Class declaration:
<br />
class CEditControlDlg : public CDialog<br />
{<br />
// Construction<br />
public:<br />
 CEdit *m_pEdit; // Added by Sayan<br />
 CButton *m_pButton; // Added by Sayan<br />
<br />
 CEditControlDlg(CWnd* pParent = NULL);	// standard constructor<br />
// ...<br />
// ...<br />
}<br />


Function definition - InitDialog():
<br />
BOOL CEditControlDlg::OnInitDialog()<br />
{<br />
 CDialog::OnInitDialog();<br />
<br />
 // Set the icon for this dialog.  The framework does this automatically<br />
 //  when the application's main window is not a dialog<br />
 SetIcon(m_hIcon, TRUE);			// Set big icon<br />
 SetIcon(m_hIcon, FALSE);		// Set small icon<br />
	<br />
 // TODO: Add extra initialization here<br />
 m_pEdit = (CEdit *)GetDlgItem(EF_TEXT); // Added by Sayan<br />
 m_pButton = (CButton *)GetDlgItem(PB_DONE); // Added by Sayan<br />
<br />
 m_pButton->EnableWindow(FALSE); // Added by Sayan<br />
 return TRUE;  // return TRUE  unless you set the focus to a control<br />
}<br />



Function definition - EN_CHANGE handler function:
<br />
void CEditControlDlg::OnChangeText() <br />
{<br />
 // TODO: If this is a RICHEDIT control, the control will not<br />
 // send this notification unless you override the CDialog::OnInitDialog()<br />
 // function and call CRichEditCtrl().SetEventMask()<br />
 // with the ENM_CHANGE flag ORed into the mask.<br />
	<br />
 // TODO: Add your control notification handler code here<br />
 CString strText;<br />
<br />
 m_pEdit->GetWindowText(strText);<br />
<br />
 if (!strText.GetLength())<br />
 {<br />
 	m_pButton->EnableWindow(FALSE);<br />
 }<br />
 else<br />
 {<br />
 	m_pButton->EnableWindow();<br />
 }<br />
}<br />



With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
GeneralExcel locks up Pin
Zizilamoroso29-Aug-02 5:28
Zizilamoroso29-Aug-02 5:28 
QuestionCan Visual C++ (6.0) print the whole List Box contents? Pin
Anonymous29-Aug-02 5:09
Anonymous29-Aug-02 5:09 
GeneralTimer IDs Pin
JohnnyG29-Aug-02 4:39
JohnnyG29-Aug-02 4:39 
GeneralRe: Timer IDs Pin
Chris Losinger29-Aug-02 4:42
professionalChris Losinger29-Aug-02 4:42 
GeneralRe: Timer IDs Pin
Tomasz Sowinski29-Aug-02 4:45
Tomasz Sowinski29-Aug-02 4:45 
GeneralRe: Timer IDs Pin
JohnnyG29-Aug-02 4:45
JohnnyG29-Aug-02 4:45 
GeneralCRecordView has no DoModal function Pin
gate7ole29-Aug-02 3:51
gate7ole29-Aug-02 3:51 
GeneralRe: CRecordView has no DoModal function Pin
Tomasz Sowinski29-Aug-02 4:14
Tomasz Sowinski29-Aug-02 4:14 
GeneralCRecordView has no DoModal function Pin
Anonymous29-Aug-02 3:51
Anonymous29-Aug-02 3:51 
GeneralRedistribution question Pin
ns29-Aug-02 2:36
ns29-Aug-02 2:36 
GeneralRe: Redistribution question Pin
Tomasz Sowinski29-Aug-02 2:54
Tomasz Sowinski29-Aug-02 2:54 
GeneralRe: Redistribution question Pin
Stephane Rodriguez.29-Aug-02 3:21
Stephane Rodriguez.29-Aug-02 3:21 
GeneralRe: Redistribution question Pin
Tomasz Sowinski29-Aug-02 3:26
Tomasz Sowinski29-Aug-02 3:26 
GeneralRe: Redistribution question Pin
Stephane Rodriguez.29-Aug-02 3:29
Stephane Rodriguez.29-Aug-02 3:29 
GeneralRe: Redistribution question Pin
Tomasz Sowinski29-Aug-02 3:37
Tomasz Sowinski29-Aug-02 3:37 
GeneralRe: Redistribution question Pin
Stephane Rodriguez.29-Aug-02 3:50
Stephane Rodriguez.29-Aug-02 3:50 
GeneralRe: Redistribution question Pin
Tomasz Sowinski29-Aug-02 4:02
Tomasz Sowinski29-Aug-02 4:02 

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.