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

在MDI窗口里打開一個子窗口若關閉后再次打開出錯!

答題得分者是:william
longjibo
一般會員


發表:18
回覆:18
積分:12
註冊:2002-11-08

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-11-30 17:28:36 IP:218.16.xxx.xxx 未訂閱
代碼如下: if not assigned(frm02) then begin application.CreateForm(tfrm02,frm02); frm02.show; exit; end else frm02.Show; end; 請多多指教!
CJF
一般會員


發表:5
回覆:14
積分:8
註冊:2002-10-25

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-12-02 12:27:17 IP:211.21.xxx.xxx 未訂閱
引言: 代碼如下: if not assigned(frm02) then 請問這行是在做什麼呀? begin application.CreateForm(tfrm02,frm02); frm02.show; exit; end else frm02.Show; end; 請多多指教!
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-12-02 12:39:44 IP:147.8.xxx.xxx 未訂閱
You should set frm02 to nil after freeing it, otherwise Assigned(frm02) will be True. So you should not relay on setting Action := caFree in the OnClose event of tfrm02. Maybe you can try to send a message from frm02 to the main form when it closes to tell the main form to set frm02 to nil?
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-12-02 12:42:19 IP:147.8.xxx.xxx 未訂閱
Oh~~ forget about the topics title. Since your application is a MDI application, you may want to take a look at MDIChildCount and MDIChildren properties. 
Miles
尊榮會員


發表:27
回覆:662
積分:622
註冊:2002-07-12

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-12-02 15:20:39 IP:210.58.xxx.xxx 未訂閱
Hello longjibo: 請在frm02的OnClose事件加上 Action := caFree; frm02 := nil 這樣應該沒問題 我不是高手, 高手是正在銀幕前微笑的人.
------


我不是高手, 高手是正在銀幕前微笑的人.
longjibo
一般會員


發表:18
回覆:18
積分:12
註冊:2002-11-08

發送簡訊給我
#6 引用回覆 回覆 發表時間:2002-12-03 08:19:16 IP:218.16.xxx.xxx 未訂閱
已更正此問題: //if not assigned(frm02) then if frm02<>nil then begin application.CreateForm(tfrm02,frm02); frm02.show; exit; end else frm02.Show; end;    而在frm02的CLOSE事件中 ca:=free; frm02:=nil;    就可以重復打開關閉frm02了。 謝謝各位先進關注!
系統時間:2024-05-05 18:44:51
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!