从8 in nos中选择一个复选框并返回1值,其他复选框应禁用 [英] Select one checkbox from 8 in nos and returning 1 value and other checkboxes should be disabled
本文介绍了从8 in nos中选择一个复选框并返回1值,其他复选框应禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
在我的基于MFC对话的应用程序中,有32个复选框,排列为8 * 4。所以我的疑问是每当我点击行中的一个复选框时,应该禁用相应列的剩余三个复选框!!
现在我为所有32个复选框事件单独为所有复选框编写代码处理程序如下:
Hi!
In my MFC dialogue based application there are 32 checkboxes which are arranged as 8*4. So my doubt is whenever I click on one of the check box in row then there should be disable remaining three checkbox of respective column!!
Now I write code for all check boxes individually for all 32 checkboxes event handler as given below:
void Check_Test::OnBnClickedcheck1()
{
// TODO: Add your control notification handler code here
if(btn_check1.GetCheck()!=BST_CHECKED)
{
GetDlgItem(IDC_CHECK9)->EnableWindow(1);
GetDlgItem(IDC_CHECK17)->EnableWindow(1);
}
else
{
GetDlgItem(IDC_CHECK9)->EnableWindow(0);
GetDlgItem(IDC_CHECK17)->EnableWindow(0);
}
}
所有复选框行为是否有任何常用功能或控件?
谢谢提前!!!
So is there any common function or control for all check box behaviour??
Thanks in advance!!!
推荐答案
为了实现这一行为,我最好使用单选按钮 - 只需将列表中的单选按钮分组!在这种情况下,没有必要的编码:检查按钮之一将导致取消检查同一列中的其余按钮。
To achieve this behavior I would better use Radio Buttons - just group the radio buttons column-like! In this case there is no coding necessary than: the checking one of the button will cause the un-checking the rest of the buttons in the same column.
这篇关于从8 in nos中选择一个复选框并返回1值,其他复选框应禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文