The MASM Forum

General => The Campus => Topic started by: gelatine1 on January 16, 2016, 08:17:57 AM

Title: Setting the value of a radiobutton in a dialog box
Post by: gelatine1 on January 16, 2016, 08:17:57 AM
Hi, I have the following rc file (snippet) describing a dialog box with 2 radio buttons.


MyDialog DIALOG 10, 10, 150, 70
CAPTION "Change start and end"
BEGIN
    DEFPUSHBUTTON   "Confirm", IDC_CONFIRM,    91,10,52,13
    PUSHBUTTON      "Cancel", IDC_EXIT,  91,26,52,13
    AUTORADIOBUTTON "Random", IDC_RADIO_LINEAR , 12,45,40,13, 131072 // 131072 = WS_GROUP
    AUTORADIOBUTTON "Linear", IDC_RADIO_RANDOM , 62,45,30,13
END


When I initialise the dialog box both the radiobuttons appear not selected. How would I select one of the radiobuttons from within my code (after WM_INITDIALOG) ?

Thanks in advance
Title: Re: Setting the value of a radiobutton in a dialog box
Post by: ragdog on January 16, 2016, 08:48:17 AM
Hello

invoke CheckDlgButton,hWnd,1002,BST_CHECKED

Regards,
Title: Re: Setting the value of a radiobutton in a dialog box
Post by: dedndave on January 16, 2016, 11:47:28 AM
actually, radio buttons have their own function, used to select which button of a group is checked

CheckRadioButton

https://msdn.microsoft.com/en-us/library/windows/desktop/bb761877%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb761877%28v=vs.85%29.aspx)
Title: Re: Setting the value of a radiobutton in a dialog box
Post by: gelatine1 on January 16, 2016, 11:23:28 PM
Okay thanks! clearly I was looking in the wrong place..