Click to See Complete Forum and Search --> : Radio Buttons, and Edit boxes


Rossi
April 17th, 1999, 01:59 AM
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: allen@ct.spi.co.za
==============================================

Lynx
April 17th, 1999, 02:31 AM
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