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

    Radio Buttons, and Edit boxes

    Hi,


    I have a dialog with two radio buttons, and next to each button, there a readonly editbox.
    What I want is that if a radoi button has been selected, then the edit box must be writable, and the focus must be on this edit box.

    I don't know how to do this, and would appreciate any help/advice.
    Any code would also help.

    Thanks is advance.

    Cheers.

    ==============================================
    Allen Van Der Ross
    Systems Programmer
    Software Performance Improvement
    South Africa
    E-Mail: [email protected]
    ==============================================

  2. #2
    Join Date
    Apr 1999
    Location
    CA, USA
    Posts
    78

    Re: Radio Buttons, and Edit boxes

    You need to create a message handler (BN_CLICKED) for the desired radio button. For example: the OnRadioClicked() will handle the BN_CLICKED message for your radiobox and the editbox's ID is IDC_MYEDITBOX.
    OnRadioClicked()
    {
    // TODO: Add your control notification handler code here
    CEdit *pEdit = (CEdit*)GetDlgItem(IDC_MYEDITBOX);
    ASSERT(pEdit != NULL);

    pEdit->SetReadOnly(FALSE); // set it to be read/write
    pEdit->SetFocus(); // set the focus to the editbox

    }


    Hope this will help. Good luck.

    Lynx


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