September 8th, 2003, 09:01 AM
how to enable a button when the dialog changes
Hi, I have a Dialog box using MFC. I added to edit boxes to the field and one selection box. I have a "Reset" button that is diabled/greyed when the form is created. When either the edit boxes or selection boxes are changed I would like to enable the reset button. I am not sure what message handeler to use to see if the fields have been changed.
Thanks in advance,
September 8th, 2003, 11:56 AM
Take a look at EnableWindow Function for the Win32 version. I never use MFC, but this CodeGuru page shows an example:
GetDlgItem( IDC_BUTTON1 )->EnableWindow(TRUE);
GetDlgItem( IDC_BUTTON1 )->EnableWindow(FALSE);
September 8th, 2003, 12:24 PM
How do I know when a field has been changed? I know how to enable the button, just not sure what event to use to trigger the change
September 8th, 2003, 03:17 PM
You can try hooking to the EN_CHANGE or EN_UPDATE event for edit boxes and CBN_EDITCHANGE or CBN_EDITUPDATE event for combo boxes.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo