Click to See Complete Forum and Search --> : How to make the radio buttons read only?


Zulfi Khan
May 31st, 1999, 03:08 AM
I have got some radio buttons grouped in my dialog box. I want to make them read only (i.e they should not be checked).

Chao
May 31st, 1999, 03:45 AM
Hi,

I think all you have to do is to click on the "disabled" checkbox corresponding to that radio button.

Zulfi Khan
May 31st, 1999, 04:18 AM
Actaully,I want to do it programmatically.

DangCongWei
May 31st, 1999, 07:31 AM
Then use ::EnableWindow () to do it.

Zulfi Khan
June 1st, 1999, 04:22 AM
Sir, I dont understand how will it work? I read the Help, it says its used for entire dialog box. I want to enable or disable a particular radio button programmatically.

DangCongWei
June 1st, 1999, 05:48 AM
Hi:
You should get the handle of the radio-button from the
control's ID (for example, IDC_RADIO1), by using this API :

HWND hRadio1 = GetDlgItem (hDlg, IDC_RADIO1) ;



And then, you can use EnableWindow () like this :

EnableWindow (hRadio1, FALSE) ;



And the radio button will be disabled and grayed.
For simple, you can just write your code like this :

EnableWindow (GetDlgItem (hDlg, IDC_RADIO1), FALSE) ;




Bye




Best Regards !
-- Dang --

Chao
June 1st, 1999, 08:11 PM
Hi,

Try this:
GetDlgItem(IDC_RADIO)->EnableWindow(FALSE);

Hope that works.

Chao

Zulfi Khan
June 2nd, 1999, 02:22 AM
Thanks its working fine. Actually your help came right on time. Atleast two hours before my demo.
Zulfi.