Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I enable a button once some event has occurred?

Status
Not open for further replies.

Sedai

Programmer
Mar 4, 2001
158
US
How can I enable a button once some event has occurred?
Like that, initially the button is disabled. The user inputs a value in an edit box and the button becomes 'press-able'.
Thanks! Avendeval


 
Hi,

assuming that you use the MFC, you could simply catch the EN_CHANGE notification from your edit control (using the class wizard), which contains code like this:

CString strTest;
m_edtInput.GetWindowText(strTest); // or use a string-member

m_btnSomeButton.EnableWindow(strTest.GetLength() != 0);

This should do the trick - it enables the button as soon as some text is typed into the edit.

Hope this helps,

Martin
 
(u must reguster in order to get a star; sorry i can't give u one right now) Avendeval


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top