Enabling or disabling dialog controls? 
Author Message
 Enabling or disabling dialog controls?

I know that you can use..

CWnd* pWnd = GetDlgItem(IDC_CTRL_ID);
pWnd->EnableWindow(FALSE); // or TRUE

to enable or disable any control in a dialog.  My question is what if
you have about 8 of them?  Do you need to get a handle to every control?
How is this done?

The state of each control will be based upon what choice the user
selects from a combo box control.

Thanks!
Mark



Sat, 25 Oct 2003 07:42:15 GMT  
 Enabling or disabling dialog controls?
If you have these controls in a moda dialog box, you can use
ON_UPDATE_COMMAND_UI handlers for each of the controls(by handling
WM_KICKIDLE and using UpdateDialogControls in its handler). This is similar
to a toolbar button or menu items in a CFrameWnd. It would make your life a
lot simpler and neat:

SOmething like:

CYourDialog::OnKicKIdle(..)
{
  UPdateDialogControls();

Quote:
}

Now handle ON_UPDATE_COMMAND_UI handlers for each of the control that you
want updated.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> I know that you can use..

> CWnd* pWnd = GetDlgItem(IDC_CTRL_ID);
> pWnd->EnableWindow(FALSE); // or TRUE

> to enable or disable any control in a dialog.  My question is what if
> you have about 8 of them?  Do you need to get a handle to every control?
> How is this done?

> The state of each control will be based upon what choice the user
> selects from a combo box control.

> Thanks!
> Mark



Sat, 25 Oct 2003 08:10:55 GMT  
 Enabling or disabling dialog controls?


Quote:
> If you have these controls in a moda dialog box, you can use
> ON_UPDATE_COMMAND_UI handlers for each of the controls(by handling
> WM_KICKIDLE and using UpdateDialogControls in its handler). This is
similar
> to a toolbar button or menu items in a CFrameWnd. It would make your
life a
> lot simpler and neat:

> SOmething like:

> CYourDialog::OnKicKIdle(..)
> {
>   UPdateDialogControls();
> }

> Now handle ON_UPDATE_COMMAND_UI handlers for each of the control that
you
> want updated.

I assume the above would need to be created manually (vs wizard)?
Thanks I'll work on this.


Sat, 25 Oct 2003 08:26:19 GMT  
 Enabling or disabling dialog controls?
Another question,

How come WM_KICKIDLE is not in the msdn message reference?

Abbas Cakmak


Quote:
>If you have these controls in a moda dialog box, you can use
>ON_UPDATE_COMMAND_UI handlers for each of the controls(by handling
>WM_KICKIDLE and using UpdateDialogControls in its handler). This is similar
>to a toolbar button or menu items in a CFrameWnd. It would make your life a
>lot simpler and neat:

>SOmething like:

>CYourDialog::OnKicKIdle(..)
>{
>  UPdateDialogControls();
>}

>Now handle ON_UPDATE_COMMAND_UI handlers for each of the control that you
>want updated.

>--
>Ajay Kalra [MVP - VC++]

>Note: Please post all replies to newsgroup only.



>> I know that you can use..

>> CWnd* pWnd = GetDlgItem(IDC_CTRL_ID);
>> pWnd->EnableWindow(FALSE); // or TRUE

>> to enable or disable any control in a dialog.  My question is what if
>> you have about 8 of them?  Do you need to get a handle to every control?
>> How is this done?

>> The state of each control will be based upon what choice the user
>> selects from a combo box control.

>> Thanks!
>> Mark



Sat, 25 Oct 2003 17:58:09 GMT  
 Enabling or disabling dialog controls?
Its one of those MFC custom messages. Look in the source code for this.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> Another question,

> How come WM_KICKIDLE is not in the msdn message reference?

> Abbas Cakmak


> >If you have these controls in a moda dialog box, you can use
> >ON_UPDATE_COMMAND_UI handlers for each of the controls(by handling
> >WM_KICKIDLE and using UpdateDialogControls in its handler). This is
similar
> >to a toolbar button or menu items in a CFrameWnd. It would make your life
a
> >lot simpler and neat:

> >SOmething like:

> >CYourDialog::OnKicKIdle(..)
> >{
> >  UPdateDialogControls();
> >}

> >Now handle ON_UPDATE_COMMAND_UI handlers for each of the control that you
> >want updated.

> >--
> >Ajay Kalra [MVP - VC++]

> >Note: Please post all replies to newsgroup only.



> >> I know that you can use..

> >> CWnd* pWnd = GetDlgItem(IDC_CTRL_ID);
> >> pWnd->EnableWindow(FALSE); // or TRUE

> >> to enable or disable any control in a dialog.  My question is what if
> >> you have about 8 of them?  Do you need to get a handle to every
control?
> >> How is this done?

> >> The state of each control will be based upon what choice the user
> >> selects from a combo box control.

> >> Thanks!
> >> Mark



Sun, 26 Oct 2003 00:31:32 GMT  
 Enabling or disabling dialog controls?
Thanks Ajay,
It works like a charm! (c:
Mark


Wed, 29 Oct 2003 06:40:40 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. In what function are controls in dialog based appl enabled/disabled

2. enable/disable controls at runtime in Dialogs

3. Enabling and disabling controls in a dialog box

4. How to enable/disable dialog controls?

5. How to enable/disable dialog controls?

6. File Open Dialog - Open button Enable&Disable

7. File Open Dialog - Open button Enable&Disable

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

9. File Open Dialog - Open button Enable&disable

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

11. Enabling/Disabling a dialog Button

12. Real Simple: Enabling/disabling buttons on Dialog boxes

 

 
Powered by phpBB® Forum Software