Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
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!!!
Posted 26-Feb-13 21:25pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Comments
Sameer_awana at 27-Feb-13 9:14am
   
But in that respective row of check box we can select multiple,so in radio button control this is not possible!!
This is main problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 330
1 BillWoodruff 260
2 Sergey Alexandrovich Kryukov 240
3 OriginalGriff 216
4 Afzaal Ahmad Zeeshan 208
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web02 | 2.8.1411019.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100