demonstrate the use of RadioGroup tool in Delphi
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.
Bookmark:
demonstrate the use of RadioGroup tool in Delphi
Here is how you setup Calculate button on click event.
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 Delphi Tutorials.
Download materials for this article (Delphi - Tutorials)
Radio-Group.zip
File size: 4 KB, File type: zip
Total downloads: 1172, Upload date: February 02 - 2009
lala :: February 17-2009 :: 01:51 PM
thanks alot for letting me know this.