Иллюстрированный самоучитель по Kylix

       

Код автоматически создаваемой для MDIприложения



Листинг 10.6.Код,автоматически создаваемой для MDI-приложения

unit clxmain;
interface
uses SysUtils, Classes, QForms, OImgList , QStdActns, QActnList , QDialogs, QMenus, QTypes, QComCtrls, QControls, QExtCtrls;
type
TMainForm - class(TForm) MainMenu1: TMainMenu; File1: TMenuItem; FileNewItem: TMenuItem; FileOpenItem; TMenuItem; FileCloseItem: TMenuItem; Window1: TMenuItem; Help1: TMenuItem; N1: TMenuItem; FileExitItem: TMenuItem; WindowCascadeItem: TMenuItem; WindowTileItem: TMenuItem; HelpAboutItem: TMenuItem; OpenDialog: TOpenDialog; FileSaveItem: TMenuItem; FileSaveAsItem: TMenuItem; Edit1: TMenuItem; CutItem: TMenuItem; CopyItem: TMenuItem; PasteItem: TMenuItem;
WindowMinimizeItem: TMenuItem; StatusBar: TStatusBar; ActionList1: TActionList; EditCut1: TEditCut; EditCopy1: TEditCopy; EditPaste1: TEditPaste; FileNew1: TAction; FileSave1: TAction; FileExit1: TAction; FileOpen1: TAction; FileSaveAs1: TAction; WindowCascade1: TWindowCascade; WindowMinimizeAll1: TWindowMiniraizeAll; HelpAbout1: TAction; FileClose1: TWindowClose; WindowTileItem2: TMenuItem; ToolBar2: TToolBar; ToolButton1: TToolButton; ToolButton2: TToolButton; ToolButton3: TToolButton; ToolButton4: TToolButton; ToolButton5: TToolButton; ToolButton6: TToolButton; ToolButton9: TToolButton; ToolButton7: TToolButton; ToolButton8: TToolButtun; ToolButton10: TToolButton; ToolButton11: TToolButton; WindowClose1: TWindowClose; WindowTile1: TWindowTile; ToolButton12: TToolButton; ImageList1: TImageList;
procedure FileNew1Execute(Sender: TObject);
procedure FileOpen1Execute(Sender: TObject);
procedure HelpAbout1Execute(Sender: TObject);
procedure FileExit1Execute(Sender: TObject);
private
{ Private declarations}

procedure CreateMDIChild(const Name: string);
public
{ Public declarations } end;
var
MainForm: TMainForm; implementation
{$R *.xfm}
uses clxchildwin, clxabout;
procedure TMainForm.CreateMDIChild(const Name: string);
var
Child: TMDIChild; begin { создание нового дочернего MDI-окна },
Child := TMDIChild.Create(Application);

Child.Caption := Name;
if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
end;
procedure TMainForm.FileNew1Execute(Sender: TObject);
begin
CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
end;
procedure TMainForm.FileOpen1Execute(Sender: TObject);
begin
if OpenDialog.Execute then
CreateMDIChild(OpenDialog.FileName);
end;
procedure TMainForm.HelpAbout1Execute(Sender: TObject);
begin
AboutBox.ShowModal; end;
procedure TMainForm.FileExit1Execute (Sender: TObject);
begin
Close; end; end.

Назад
Содержание
Вперед


Содержание раздела