MDI |
答題得分者是:ccchen
|
is_tem
一般會員 ![]() ![]() 發表:17 回覆:15 積分:11 註冊:2002-04-17 發送簡訊給我 |
In a MDI development, there are forms, each form contain a DBGrid linked to a data module.
I would like adding icon FIRST, PREVIOUS, NEXT, LAST, INSERT, DELETE in the tool bar of the main form. How can we program this? For example, Child form A show table A record is BOF; Child form B show table A record is EOF, etc. I would also want to place a CLOSE icon in the tool bar for closing the current active form? How can it achieve?
|
ccchen
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:61 回覆:940 積分:1394 註冊:2002-04-15 發送簡訊給我 |
procedure TMdiMainForm.ToolButton1Click(Sender: TObject); var dsinfo: PPropinfo; ctrl:TControl; ds:TDataSet; begin if ActiveMDIChild <> nil then //ActiveMDIChild為目前Active 之child if ActiveMDIChild.ActiveControl<>nil then begin ctrl:=ActiveMDIChild.ActiveControl; //按toolButton前之active Control dsinfo := GetPropinfo(ctrl, 'DataSource');//取得該control是否有datasoure property if dsinfo<>nil then begin ds := TDataSource(GetOrdProp(ctrl,dsinfo)).DataSet; //取得Dataset showmessage(ds.name); end; end; end;上面程式Demo如何取得目前ActiveControl所對應到之DataSet, 我想之後的工作(FIRST, PREVIOUS, NEXT, LAST, INSERT, DELETE)針對此DataSet你應該沒問題了吧 close之toolButton直接 if ActiveMDIChild <> nil then ActiveMDIChild.close;須注意, mdiChild之close只是minimize,真的要close可在每一mdiChild之onClose加上 Action:=caFree; |
is_tem
一般會員 ![]() ![]() 發表:17 回覆:15 積分:11 註冊:2002-04-17 發送簡訊給我 |
|
is_tem
一般會員 ![]() ![]() 發表:17 回覆:15 積分:11 註冊:2002-04-17 發送簡訊給我 |
|
ccchen
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:61 回覆:940 積分:1394 註冊:2002-04-15 發送簡訊給我 |
|
delphiwww
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:145 回覆:363 積分:368 註冊:2002-03-13 發送簡訊給我 |
你可以直接使用ActionList,然後將DataSet中所有Action叫出,
然後在相對應的Button選取Action就可以
引言: In a MDI development, there are forms, each form contain a DBGrid linked to a data module. I would like adding icon FIRST, PREVIOUS, NEXT, LAST, INSERT, DELETE in the tool bar of the main form. How can we program this? For example, Child form A show table A record is BOF; Child form B show table A record is EOF, etc. I would also want to place a CLOSE icon in the tool bar for closing the current active form? How can it achieve? |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |