全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:531
推到 Plurk!
推到 Facebook!

button如何連結到另一個畫面呢?

尚未結案
evoneliu
一般會員


發表:12
回覆:10
積分:4
註冊:2004-10-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-10-21 17:14:42 IP:220.130.xxx.xxx 未訂閱
dear 請問我如何於主畫面中增加一個新的button,並接下後可跳到另一個畫面維護資料呢?這其中的連結,程式需如何撰寫與連接呢?由於我是個初學者,功力很差,還麻煩幫忙解說時詳細些,謝謝你大爺!
chris_shieh
高階會員


發表:46
回覆:308
積分:240
註冊:2004-04-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-10-21 18:12:05 IP:61.30.xxx.xxx 未訂閱
建立新project, 並new兩個form    form1 檔案 Unit1.pas:
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;    type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    uses Unit2;    {$R *.dfm}    procedure TForm1.Button1Click(Sender: TObject);
begin
   //form2 按下任何按鍵都會回到form1
   Form2.ShowModal;       //或 只有在form2按下OK 才會回到 form1
   {
   repeat
   until (Form2.ShowModal=mrOK);
   }
end;    end.     
form2 檔案 Unit2.pas:
unit Unit2;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;    type
  TForm2 = class(TForm)
    BitBtn_OK: TBitBtn;
    BitBtn_Cancel: TBitBtn;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form2: TForm2;    implementation    {$R *.dfm}    procedure TForm2.FormCreate(Sender: TObject);
begin
   BitBtn_OK.Kind:=bkOK;
   BitBtn_Cancel.Kind:=bkCancel;
end;    end.     
evoneliu
一般會員


發表:12
回覆:10
積分:4
註冊:2004-10-21

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-10-22 08:57:51 IP:220.130.xxx.xxx 未訂閱
dear 非常謝謝你的解說,感謝,但為何我依樣畫胡盧時,會出現以下error呢?謝謝! error module 'form' link to module 'dm' which cannot be found in the current project . Do you wish to remove/redirect the links to another module?
系統時間:2024-06-29 21:21:33
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!