enable and disable command buttons 
Author Message
 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.


Fri, 02 Jul 2004 12:27:09 GMT  
 enable and disable command buttons
Does the disabled button still accept mouse click? Where is the button located? The following article is for your reference:

HOWTO: How To Disable Push Buttons on a DialogBar in MFC (Q152376)
http://support.microsoft.com/support/kb/articles/Q152/3/76.asp

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

Need quick answers to questions like these? The Microsoft Knowledge Base provides a wealth of information that you can use to troubleshoot a problem or answer a
question! It's located at http://support.microsoft.com/support/c.asp?M=F>.

--------------------

Quote:

>Newsgroups: microsoft.public.vc.ide_general,microsoft.public.vc.events
>Subject: enable and disable command buttons


>X-Newsreader: Forte Agent 1.8/32.548
>MIME-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>Lines: 21

>X-Abuse-Info: Please be sure to forward a copy of ALL headers
>X-Abuse-Info: Otherwise we will be unable to process your complaint properly.
>NNTP-Posting-Date: Sun, 13 Jan 2002 23:23:47 EST
>Organization: Bellsouth.Net
>Date: Sun, 13 Jan 2002 23:27:09 -0500
>Path: cpmsftngxa07!tkmsftngp01!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!hub1.nntpserver.com!peer1-

sjc1.usenetserver.com!fs01-sjc1.usenetserver.com!usenetserver.com!filter.west.usenetserver.com!filter.usenetserver.com!e3500-atl2.usenetserver.com.POSTED!
53ab2750!not-for-mail

- Show quoted text -

Quote:
>Xref: cpmsftngxa07 microsoft.public.vc.events:4833 microsoft.public.vc.ide_general:20128
>X-Tomcat-NG: microsoft.public.vc.ide_general

>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);
>    ...
>}

>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.



Sun, 04 Jul 2004 12:02:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Enabling/Disabling PushButton/Command Buttons

2. enable/disable toolbar button using pCmdUI->Enable(TRUE/FALSE) doesnt work

3. Enable/Disable menus/buttons similar to MFC ON_UPDATE_COMMAND_UI

4. Enable / Disable a button

5. Disable/Enable Button

6. Grouped Radio Buttons, Enable and Disable

7. Enable/Disable buttons?

8. File Open Dialog - Open button Enable&Disable

9. File Open Dialog - Open button Enable&Disable

10. How to enable or disable a button control?

11. How to enable/disable Toolbar button in Dialog Based MFC application

12. Enable/Disable OK button on CPropertySheet

 

 
Powered by phpBB® Forum Software