my aim is to select a radiobutton and then push a pushbutton. that pushbutton will retrieve the selected radiobutton's text..
Printable View
my aim is to select a radiobutton and then push a pushbutton. that pushbutton will retrieve the selected radiobutton's text..
Are you having trouble with knowing when you pressed the push button?
see.. i want to select a radiobutton and retrieve that radio's name by a messagebox by pressing a pushbutton..
So I suppose that means yes? It is the same for any type of button
is that what you wanted?Code:case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case ID_PUSHBUTTON:
if ( HIWORD(wParam) == BN_CLICKED)
{
WCHAR text[100];
SendMessage((HWND)hRadio, WM_GETTEXT, 100, (LPARAM)text);
MessageBox(0,text,0,0);
}
break;
}
}
@..Victor N.
HWND hRadio[10] is declared globally... and SendMessage() can not cast to HWND to HWND_ thats wht (HWND)hRadio.
@..Joeman
Ya this I need.. But in..
SendMessage((HWND)hRadio, WM_GETTEXT, 100, (LPARAM)text);
hRadio index should be mentioned.. here is the problem. selected radiobutton's index should be mentioned here..
I suppose you can loop through each radio button and check to see which is checked with IsDlgButtonChecked or SendMessage.. for ex
now you have the Id in RadioIdCode:
//loop code
LRESULT lResult = SendMessage( hRadio[i], BM_GETCHECK, 0, 0 );
bool Checked = lResult == BST_CHECKED;
if( Checked ) RadioId = i;
//end of loop code
@..VictorN
i have checked radiobutton 1.. by putting
CheckRadioButton(hReIP, ID_RADIO1, ID_RADIO10, ID_RADIO1);
in WM_INITDIALOG.
@..Joeman
I think this code is going to be useful for me. Let me implement it a bit more.. Thanks..