我想请问一下,我在一个窗体中写好了这个:
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  TFunctionParameter = function(const value : integer) : string;
var
  Form1: TForm1;
  function One(const number : integer) : string;
  function Two(const number : integer) : string;
  function DynamicFunction(f : TFunctionParameter; const number : integer) : string;implementation{$R *.dfm}
function One(const number : integer) : string;
begin
     result := IntToStr(number);
end;
function Two(const number : integer) : string;
begin
   result := IntToStr(2 * number) ;
end;function DynamicFunction(f : TFunctionParameter; const number : integer) : string;
begin
    result := f(number);
end;procedure TForm1.Button1Click(Sender: TObject);
var
   ss : String;
begin
    ss :=  DynamicFunction(One,StrToInt(edit1.Text));
    ShowMessage('第一个的值:'+ss);
end;procedure TForm1.Button2Click(Sender: TObject);
var
   ss : String;
begin
    ss :=  DynamicFunction(Two,StrToInt(edit1.Text));
    ShowMessage('第二个的值:'+ss);
end;
end.====================================
然后我在另一个页面不知道怎么去调用这个页面中的函数...求指教

解决方案 »

  1.   

    在另一个页面的interface下Use Unit1;,然后就可以直接像下面这样用你的那些函数了
    var
        ss : String;
     begin
         ss :=  DynamicFunction(One,StrToInt(edit1.Text));
         ShowMessage('第一个的值:'+ss);
     end; var
        ss : String;
     begin
         ss :=  DynamicFunction(Two,StrToInt(edit1.Text));
         ShowMessage('第二个的值:'+ss);
     end;
      

  2.   

    这些函数定义在unit Unit1;
    假设你在 unit unit2中unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
    ....
    implementation{$R *.dfm}
    uses unit1; // 引入unit1单元....
    // 然后就可以调用unit1的DynamicFunction
    begin
      unit1.function One(100);
    end;
      

  3.   

    先把需要调用的函数窗口加载上,然后form名+函数名这么调用就可以了。
    其实我是来增加回复的,分又不偶用啦。楼上的说的挺详细的。