
enable and disable command buttons
I have a dialog-based application, and I want to be able to enable /
disable some of the controls on the dialog while it's displayed.
(disable the first record and previous record buttons, for example,
when the database is already at the first record). I created control
variables for the buttons I want to disable, and then a member fxn
like this:
CADOdlg::DoControlStates()
{
m_cmdFirstRecord.EnableWindow( ! isBOF);
...
Quote:
}
The controls don't disable, however. Funny thing, is that if, in
OnInitDialog() I call EnableWindow(false); for a particular control,
the control IS disabled, but it doesn't seem to work once the dialog
is displayed. I am assuming that I need to do something else to cause
the window to update its buttons. I have tried calling Validate() and
CADOdlg::UpdateControls() to no avail. Do I need to use something
like an ON_UPDATE_UI handler and then force an update? (and if so,
how?) Thanks.