Please leave a comment If you found BROKEN LINK OK, thanks for visit my website,...!!!

Shooter Game Chrome PC Free Download Shooter Game Angels Fall First: Planetstorm PC Download Harvest Moon - Back To Nature PC Game Download Download PC Game TMNT 2 : Battle Nexus RIP MediaFire Prince Of Persia Warrior Within Download PC Game Resident Evil 2 img 1 metal slug super vehicle Devil May Cry 3 Portable Cool Game Download

Search

Delphi - Multiple Document Interface

Multiple Document Interface (MDI) is an application that has more than one child window, all of the child window is set by a main window. Typically, there is an MDI application in the main menu and the menu is placed in the facility to manage all child windows.
Print Screen:

Picture when making File --> New

Tile Display :

Cascade Display :

Code Program :
==========| MDMAIN |===========
unit MDIMAIN;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;

type
TMDIForm = class(TForm)
MainMenu1: TMainMenu;
FileMnu: TMenuItem;
NewMnu: TMenuItem;
OpenMnu: TMenuItem;
SaveMnu: TMenuItem;
CloseMnu: TMenuItem;
N1: TMenuItem;
PrintMnu: TMenuItem;
N2: TMenuItem;
ExitMnu: TMenuItem;
WinMnu: TMenuItem;
CascadeMnu: TMenuItem;
TileMnu: TMenuItem;
OpenDlg: TOpenDialog;
procedure NewMnuClick(Sender: TObject);
procedure OpenMnuClick(Sender: TObject);
procedure CascadeMnuClick(Sender: TObject);
procedure TileMnuClick(Sender: TObject);
procedure ExitMnuClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
MDIForm: TMDIForm;

implementation
{$R *.dfm}
uses MDIChild;

procedure TMDIForm.NewMnuClick(Sender: TObject);
Var
editForm : TFormChild;
begin
EditForm :=TFormChild.Create(Self);

end;

procedure TMDIForm.OpenMnuClick(Sender: TObject);
var
EditForm : TFormChild;
begin
If OpenDlg.Execute then
begin
EditForm := TFormChild.Create(Self);
EditForm.Open(OpenDlg.FileName);
EditForm.Visible :=True;

end;
end;

procedure TMDIForm.CascadeMnuClick(Sender: TObject);
begin
cascade;
end;

procedure TMDIForm.TileMnuClick(Sender: TObject);
begin
tile;
end;

procedure TMDIForm.ExitMnuClick(Sender: TObject);
begin
showmessage ('Create by : Laksminta Sasti (10651037)');
close;
end;

end.

==========| MDCHILD |===========

unit MDICHILD;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;

type
TFormchild = class(TForm)
MainMenu1: TMainMenu;
FileMnu: TMenuItem;
NewChildMnu: TMenuItem;
OpenChildMnu: TMenuItem;
SaveChildMnu: TMenuItem;
CloseChildMnu: TMenuItem;
N1: TMenuItem;
PrintChildMnu: TMenuItem;
N2: TMenuItem;
ExitChildMnu: TMenuItem;
EditMnu: TMenuItem;
CopyMnu: TMenuItem;
CutMnu: TMenuItem;
PasteMnu: TMenuItem;
Memo: TMemo;
SaveDlg: TSaveDialog;
procedure NewChildMnuClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SaveChildMnuClick(Sender: TObject);
procedure OpenChildMnuClick(Sender: TObject);
procedure CopyMnuClick(Sender: TObject);
procedure CutMnuClick(Sender: TObject);
procedure PasteMnuClick(Sender: TObject);
procedure CloseChildMnuClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
FileName : String;
public
{ Public declarations }
procedure Open(const AFileName : String);

end;

var
Formchild: TFormchild;

implementation
{$R *.dfm}
uses MDIMain;

procedure TFormChild.Open(const AFileName : String);
begin
FileName :=AFileName;
Memo.Lines.LoadFromFile (FileName);
Memo.SelStart :=0;
Caption :=ExtractFileName(FileName);
Memo.Modified :=False;
end;

procedure TFormchild.NewChildMnuClick(Sender: TObject);
begin
MdiForm.NewMnuClick(Sender);

end;

procedure TFormchild.FormCreate(Sender: TObject);
begin
Memo.Clear;
caption :='Untitled';
FileName :='Untitled.txt';
CutMnu.Enabled :=False;
PasteMnu.Enabled :=False;
CopyMnu.Enabled :=False;

end;

procedure TFormchild.SaveChildMnuClick(Sender: TObject);
begin
if SaveDlg.Execute then
begin
FileName := SaveDlg.FileName;
Memo.Lines.SaveToFile(FileName);

end;
end;

procedure TFormchild.OpenChildMnuClick(Sender: TObject);
begin
MDIForm.OpenMnuClick(Sender);

end;

procedure TFormchild.CopyMnuClick(Sender: TObject);
begin
if Memo.SelLength > 0 then
Memo.CopyToClipboard;

end;

procedure TFormchild.CutMnuClick(Sender: TObject);
begin
if Memo.SelLength > 0 then
Memo.CutToClipboard;

end;

procedure TFormchild.PasteMnuClick(Sender: TObject);
begin
Memo.PasteFromClipboard;

end;

procedure TFormchild.CloseChildMnuClick(Sender: TObject);
begin
close;
end;

procedure TFormchild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action := cafree;
end;

end.

Related Post

0 komentar:

Posting Komentar