#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Massachusetts
    Posts
    22
    Rep Power
    0

    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,
    Chris
  2. #2
  3. jasondoucette.com
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Canada
    Posts
    378
    Rep Power
    12
    Take a look at EnableWindow Function for the Win32 version. I never use MFC, but this CodeGuru page shows an example:
    Code:
    GetDlgItem( IDC_BUTTON1 )->EnableWindow(TRUE);
    or
    GetDlgItem( IDC_BUTTON1 )->EnableWindow(FALSE);
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Massachusetts
    Posts
    22
    Rep Power
    0
    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
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,626
    Rep Power
    4247
    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

IMN logo majestic logo threadwatch logo seochat tools logo