mainform为fsMDIForm,上面有个toolbutton1,对各个fsMDIChild进行数据修改操作,Form1\Form2\Form3...为MDI子窗体
procedure Tmainform.ToolButton1Click(Sender: TObject);
begin
if self.ActiveMDIChild.Name='Form1' then
Form1.ADOQuery1.UpdateBatch();
if self.ActiveMDIChild.Name='Form2' then
Form2.ADOQuery1.UpdateBatch();
if self.ActiveMDIChild.Name='Form3' then
Form3.ADOQuery1.UpdateBatch();
//...
end;
以上的语句能否统一写,不用每个form都写一句
procedure Tmainform.ToolButton1Click(Sender: TObject);
begin
if self.ActiveMDIChild.Name='Form1' then
Form1.ADOQuery1.UpdateBatch();
if self.ActiveMDIChild.Name='Form2' then
Form2.ADOQuery1.UpdateBatch();
if self.ActiveMDIChild.Name='Form3' then
Form3.ADOQuery1.UpdateBatch();
//...
end;
以上的语句能否统一写,不用每个form都写一句
procedure Tmainform.ToolButton1Click(Sender: TObject);
begin
TForm1(self.ActiveMDIChild).ADOQuery1.UpdateBatch();
end;