Example Delphi
Delphi Examples Collection
Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.
Take a Property Value From Many Object with As Operator
Author: admin | Category: Tips and Tricks
//This is how we can Take a property value from many Object with As Operator // Form this example we need 5 RadioButton1 to RadioButton5(TRadioButton) placed on Form1 //The we make GetRadioButtonCaption Function to be called by clicking each of RadioButton //On Click event of each TRadioButton call this GetRadioButtonCaption Function unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) RadioButton1: TRadioButton; RadioButton2: TRadioButton; RadioButton3: TRadioButton; RadioButton4: TRadioButton; RadioButton5: TRadioButton; procedure RadioButton1Click(Sender: TObject); procedure RadioButton2Click(Sender: TObject); procedure RadioButton3Click(Sender: TObject); procedure RadioButton4Click(Sender: TObject); procedure RadioButton5Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function GetRadioButtonCaption(Sender: TObject):String; begin Result :=(Sender as TRadioButton).Caption; end; procedure TForm1.RadioButton1Click(Sender: TObject); begin Showmessage(GetRadioButtonCaption(Sender)); end; procedure TForm1.RadioButton2Click(Sender: TObject); begin Showmessage(GetRadioButtonCaption(Sender)); end; procedure TForm1.RadioButton3Click(Sender: TObject); begin Showmessage(GetRadioButtonCaption(Sender)); end; procedure TForm1.RadioButton4Click(Sender: TObject); begin Showmessage(GetRadioButtonCaption(Sender)); end; procedure TForm1.RadioButton5Click(Sender: TObject); begin Showmessage(GetRadioButtonCaption(Sender)); end; end.
Tags: As, RadioButton
Post Meta
-
Tips and Tricks -
Comments Feed -