关于procedure的嵌套

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,Unit2;

type
  TForm1 = class(TForm)
    select: TRadioGroup;
    Button1: TButton;

    procedure selectClick(Sender: TObject);
  private
    { Private declarations }
    TranWay:integer;
  public
    { Public declarations }
  end;

 

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.selectClick(Sender: TObject);    //此处为第一层procedure 需要声明
  var
    i:integer;
  procedure GetSelect(Va:integer);            //此处为第二层procedure ,不需要声明.
  begin
    form1.Button1.Caption :='你选择的是:'+(select.Items[va]);
  end;

begin
  GetSelect (select.ItemIndex);      //对第二层procedure的调用。
end;


版权声明:本文为phaze原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。