CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 1999
    Location
    Pakistan
    Posts
    207

    How to make the radio buttons read only?

    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).


  2. #2
    Join Date
    Apr 1999
    Posts
    23

    Re: How to make the radio buttons read only?

    Hi,

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



  3. #3
    Join Date
    Apr 1999
    Location
    Pakistan
    Posts
    207

    Re: How to make the radio buttons read only?

    Actaully,I want to do it programmatically.


  4. #4
    Join Date
    May 1999
    Posts
    11

    Re: How to make the radio buttons read only?

    Then use ::EnableWindow () to do it.


  5. #5
    Join Date
    Apr 1999
    Location
    Pakistan
    Posts
    207

    Re: How to make the radio buttons read only?

    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.


  6. #6
    Join Date
    May 1999
    Posts
    11

    Re: How to make the radio buttons read only?

    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 --

  7. #7
    Join Date
    Apr 1999
    Posts
    23

    Re: How to make the radio buttons read only?

    Hi,

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

    Hope that works.

    Chao


  8. #8
    Join Date
    Apr 1999
    Location
    Pakistan
    Posts
    207

    Re: How to make the radio buttons read only?

    Thanks its working fine. Actually your help came right on time. Atleast two hours before my demo.
    Zulfi.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured