尽管对话框被禁用,但对话框中的控件被启用 [英] Though dialog is disabled, controls within the dialog are enabled

查看:147
本文介绍了尽管对话框被禁用,但对话框中的控件被启用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的程序中,我已使用EnableWindow(FALSE)禁用了对话框.
当我尝试检索对话框中任何按钮的启用/禁用状态时,将其获取为启用.
我原以为它会被禁用.
如果这是正确的行为,请问有人可以通过调用单个函数禁用对话框中的所有控件的方法吗?

In my program I have disabled a dialog using EnableWindow(FALSE).
When I try to retrieve the enable/disable status of any button within a dialog I am getting it as enable.
I was expecting it to be disabled.
If this is correct behaviour, could anyone please let me know if there is any way I can disable all the controls within a dialog by calling a single function?

推荐答案

似乎喜欢它的预期行为.

如果禁用,则所有子窗口都将隐式禁用,尽管不会发送WM_ENABLE消息.
参考: http://msdn.microsoft.com/en-us/library /5kbfsahf(v=vs.80).aspx [ ^ ]

您可以尝试基于 [
Seems like it is expected behavior.

If disabled, all child windows are implicitly disabled, although they are not sent WM_ENABLE messages.
Ref:http://msdn.microsoft.com/en-us/library/5kbfsahf(v=vs.80).aspx[^]

You can try to make a function based on this[^].


EnableWindow(FALSE)对话框的仅禁用对话框,而不是其控件,
要禁用控制,您需要分别禁用每个按钮.
要进行一次禁用和启用功能的调用,您可以在CList中的对话框中创建控件列表,因为所有控件均源自CWnd,您可以保存在列表中并迭代列表以在单个调用中启用和禁用控件. .
喜欢..
EnableControls(BOOL bIsEnable)
{
//迭代控件列表.
POSITION pos = myControlList.GetHeadPosition();
for(int i = 0; i< myList.GetCount(); i ++)
{
CWnd * pControl = myList.GetNext(pos);
if(pControl)
{
pContro-> EnableWindow(bIsEnable);
}
}
}
EnableWindow(FALSE)of dialog disable only dialog, Not its Control,
To disable control you have individually disable each button.
To make an single call to disable and enable function you can make list of control in dialog in CList as all control derive from CWnd, you can save in list and iterate list for enable and disable Control''s in a single call....
Like..
EnableControls(BOOL bIsEnable)
{
//iterate List of control.
POSITION pos = myControlList.GetHeadPosition();
for (int i=0;i < myList.GetCount();i++)
{
CWnd* pControl = myList.GetNext(pos);
if(pControl )
{
pContro->EnableWindow(bIsEnable);
}
}
}


这篇关于尽管对话框被禁用,但对话框中的控件被启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆