MainForm.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit MainForm;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics,
- Controls, Forms, Dialogs, Menus, ComCtrls, ToolWin, DBActns, ActnList,
- ImgList;
- type
- TFormMain = class(TForm)
- ToolBar1: TToolBar;
- StatusBar1: TStatusBar;
- ImageList1: TImageList;
- ActionList1: TActionList;
- DataSetCancel1: TDataSetCancel;
- DataSetDelete1: TDataSetDelete;
- DataSetEdit1: TDataSetEdit;
- DataSetFirst1: TDataSetFirst;
- DataSetInsert1: TDataSetInsert;
- DataSetLast1: TDataSetLast;
- DataSetNext1: TDataSetNext;
- DataSetPost1: TDataSetPost;
- DataSetPrior1: TDataSetPrior;
- DataSetRefresh1: TDataSetRefresh;
- ToolButton1: TToolButton;
- ToolButton2: TToolButton;
- ToolButton3: TToolButton;
- ToolButton4: TToolButton;
- ToolButton5: TToolButton;
- ToolButton6: TToolButton;
- ToolButton7: TToolButton;
- ToolButton8: TToolButton;
- ToolButton9: TToolButton;
- ToolButton10: TToolButton;
- PageControl1: TPageControl;
- TabCompanies: TTabSheet;
- TabClasses: TTabSheet;
- TabFreeQ: TTabSheet;
- procedure FormCreate(Sender: TObject);
- procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- procedure PageControl1Change(Sender: TObject);
- public
- procedure ShowForm (Form: TForm; Tab: TTabSheet); overload;
- end;
- var
- FormMain: TFormMain;
- implementation
- uses
- MainData, CompaniesForm,
- FreeQueryForm, ClassesForm;
- {$R *.DFM}
- procedure TFormMain.FormCreate(Sender: TObject);
- begin
- ShortDateFormat := 'dd/mm/yyyy';
- ShowForm (TFormCompanies.Create (self), TabCompanies);
- end;
- procedure TFormMain.ShowForm (Form: TForm; Tab: TTabSheet);
- begin
- Form.BorderStyle := bsNone;
- Form.Align := alClient;
- Form.Parent := Tab;
- Form.Show;
- end;
- procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- var
- i: integer;
- begin
- // ask permission to close each subform
- CanClose := True;
- for i := 0 to Screen.FormCount - 1 do
- if Screen.Forms[I] <> self then
- CanClose := CanClose and Screen.Forms[I].CloseQuery;
- end;
- procedure TFormMain.PageControl1Change(Sender: TObject);
- begin
- if PageControl1.ActivePage.ControlCount = 0 then
- if PageControl1.ActivePage = TabFreeQ then
- ShowForm (TFormFreeQuery.Create (self), TabFreeQ)
- else if PageControl1.ActivePage = TabClasses then
- ShowForm (TFormClasses.Create (self), TabClasses);
- end;
- end.