cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anilkumar_mca
Level 8

how to enable/ disable radio buttons at runtime?

Hi,

Can anybody send me code to enable or disable radio buttons based on the check box selection?

if i select checkbox then radio buttons should enable otherewise it should not..

Project type: Installscript MSI
Labels (1)
0 Kudos
(6) Replies
J_anitha
Level 8

Use ShowWindow() to show\hide controls at run-time.
0 Kudos
anilkumar_mca
Level 8

Hi,

Thanks for your replay, curently i am using that for hiding, but i want to disable not hide
0 Kudos
Not applicable

I have the same question.
Can anybody give us some help?
0 Kudos
J_anitha
Level 8

Get handle for dialog and RadioButton. Use EnableWindow() for enabling\disabling the control.

hwndDlg = CmdGetHwndDlg ( szDialogName );
hWndRadBtn = GetDlgItem( IntToHex(hwndDlg),nIDRadBtn);
EnableWindow( hWndRadBtn , FALSE);

IntToHex function:


function HWND IntToHex(value)
STRING sResult;
NUMBER h1, h2;
HWND handle ;

begin

sResult = "";
LOOP:
if ( value <= 16 ) then
sResult = HexEquivalent(value) + sResult;
while (StrLength(sResult)<8)
sResult = "0" + sResult;
endwhile;
sResult = "0x" + sResult;
StrToNumHex(handle,sResult);
return handle;
else
h1 = value/16;
h2 = value-(h1*16);
sResult = HexEquivalent(h2) + sResult;
value = value/16;
goto LOOP;
endif;

end;

function STRING HexEquivalent(value)
STRING szVal;
begin
switch (value)
case 0: szVal = "0";
case 1: szVal = "1";
case 2: szVal = "2";
case 3: szVal = "3";
case 4: szVal = "4";
case 5: szVal = "5";
case 6: szVal = "6";
case 7: szVal = "7";
case 8: szVal = "8";
case 9: szVal = "9";
case 10: szVal = "a";
case 11: szVal = "b";
case 12: szVal = "c";
case 13: szVal = "d";
case 14: szVal = "e";
case 15: szVal = "f";
default: szVal = "-";
endswitch;
return szVal;
end;

Hope it helps.
0 Kudos
Not applicable

Thanks for help.
I wrote some scripts and fix the problem.
0 Kudos
Not applicable

I use below line in my script to disable the radio button;

_WinSubEnableControl (hwndDlg, 1301, 0);
1301 - radio button identifier
0 - for disable
0 Kudos