sql.clear;sql.add(''select * from bookrecord''); file://这里相当于一个刷新功能open;end;end;end;**********************************************************************procedure tmainform.speedbutton3click(sender: tobject);begin file://库存表刷新按钮事件with datamoduleform.mainquery dobeginclose;sql.clear;sql.add(''select * from bookrecord'');open;end; end;**********************************************************************procedure tmainform.speedbutton11click(sender: tobject);var popupitem:tmenuitem;begin file://自动生成快捷按钮1的内容with datamoduleform.bookquery dobegin file://从数据库中选择出版社类型close;sql.clear;sql.add(''select distinct publisher from bookrecord'');open;popupmenu1:=tpopupmenu.create(self); file://自动生成快捷菜单
popupmenu1.autohotkeys:=mamanual; file://自定义热键while not eof dobegin file://根据出版社内容生成菜单子项popupitem:=tmenuitem.create(self);popupitem.caption:=fieldbyname(''publisher'').asstring;popupmenu1.items.add(popupitem);popupitem.onclick:=popup1handler; file://确定菜单子项的点击事件next;end; end;popupmenu1.popup(384,67); file://在指定位置显示快捷菜单1end;**********************************************************************procedure tmainform.formactivate(sender: tobject);begin file://系统初始化,在进入mainform时自动添加数据源mainform.dbgrid1.datasource:=datamoduleform.mainsource;mainform.dbnavigator1.datasource:=datamoduleform.mainsource;mainform.dbgrid2.datasource:=datamoduleform.empsource;mainform.dbnavigator2.datasource:=datamoduleform.empsource;mainform.dbgrid3.datasource:=datamoduleform.shopsource;mainform.dbnavigator3.datasource:=datamoduleform.shopsource;mainform.dbgrid4.datasource:=datamoduleform.insource;mainform.dbnavigator4.datasource:=datamoduleform.insource;mainform.dbgrid5.datasource:=datamoduleform.outsource;mainform.dbnavigator5.datasource:=datamoduleform.outsource;end;**********************************************************************procedure tmainform.formcreate(sender: tobject);
begin file://系统初始化,定义界面大小,以适应不同分辩率width:=800;height:=600;end;**********************************************************************procedure tmainform.timer1timer(sender: tobject);begin file://在状态栏显示时间statusbar1.panels[2].text:=datetostr(date);statusbar1.panels[4].text: