|
Download this example
This is more advance way of handling RadioGroup tool. Instead putting
RadioButton one by one in the list you can use Items property in
Radiogroup to add options automatically.
To
access these items use following technique
procedure TForm1.Button1Click(Sender: TObject);
Var
V1, V2, V : Variant;
N1, N2 : Real;
begin
V1:=Edit1.Text;
V2:=Edit2.Text;
N1:=Real(V1);
N2:=Real(V2);
V:=0;
{ To use following radio group method, do not
add
radio buttons manually from the tool bar. First add the
radio group window. In
the Radiogroup -> Properties use
Items category
to add radio Buttons.To check first radio button
put 1 in Itemindex category. }
Case RadioGroup1.ItemIndex of
0:V:=N1+N2;
1:V:=N1-N2;
2:V:=N1*N2;
3:V:=N1/N2;
End;
{ It is easy to use "Case" statement
instead of several "If" commands }
Label4.Caption:=V;
end;
DOWNLOAD this example
Click
here
to download this complete example for Delphi 6. (File size 4 KB)

|