Showing results for 
Search instead for 
Did you mean: 
New Contributor I

Radiobuttons and checkboxes unravelled

This is not a problem but some help to fellow developers.  Brooks V


Instructions on some dialog controls:


Integer(BOOL)::    bret
Integer(HANDLE)::  hDlg
Integer(UINT)::    uret

     bret = CheckDlgButton (hDlg, IDC_CHECKBOX1, BST_CHECKED)   ! This checks IDC_CHECKBOX1

! bret returns TRUE if IDC_CHECKBOX1 was checked

     bret = CheckDlgButton (hDlg, IDC_CHECKBOX2, BST_UNCHECKED) ! This unchecks IDC_CHECKBOX2  

! bret returns TRUE if IDC_CHECKBOX2 was unchecked

     uret = IsDlgButtonChecked(hDlg, IDC_CHECKBOX1)

! uret returns a value of BST_CHECKED if IDC_CHECKBOX1 was checked and BST_UNCHECKED otherwise


Integer(4),parameter:: IDC_Radio1 = 1001
Integer(4),parameter:: IDC_Radio2 = 1002
Integer(4),parameter:: IDC_Radio3 = 1003
Integer(4),parameter:: IDC_Radio4 = 1004
Integer(BOOL)::   bret
Integer(UINT)::   uStatus
Integer(HANDLE):: hDlg

     bret = CheckRadioButton(hDlg, IDC_Radio1, IDC_Radio4, IDC_Radio2)

! bret returns TRUE is successful and FALSE if not.
! IDC_Radio1, IDC_Radio2, IDC_Radio3 and IDC_Radio4 were all connected
! but only IDC_Radio2 is checked. IDC_Radio1 must be the only one with
! the Group property set and all four must have their Auto button
! property selected.

   uStatus = IsDlgButtonChecked(hDlg, IDC_Radio3)

! where uStatus will equal BST_CHECKED if IDC_Radio3 is checked and
! equal to BST_UNCHECKED if it is not selected (checked).


0 Kudos
1 Reply
New Contributor I

Thanks, I was unaware of

Thanks, I was unaware of these options.

0 Kudos