Hi Aaron,
Thank you for your reply.I really appriciate it. I am still getting an error Incompatible Types Unit3.pas(30)
Here is code.
My project options are
Main form=Form3
AutoCreate Forms=Form3
Avaliable Forms=frmMDI & Form2
Project1.dpr
============
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {frmMDI},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {Form3};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm3, Form3);
Application.Run;
end.
UNIT1.dfm
==========
object frmMDI: TfrmMDI
Left = 205
Top = 177
Width = 870
Height = 500
Caption = 'frmMDI'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsMDIForm
Menu = MainMenu1
OldCreateOrder = False
OnActivate = FormActivate
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object MainMenu1: TMainMenu
Left = 424
Top = 240
object File1: TMenuItem
Caption = 'File'
object New1: TMenuItem
Caption = 'New'
OnClick = New1Click
end
object Exit1: TMenuItem
Caption = 'Exit'
OnClick = Exit1Click
end
end
end
object MainMenu2: TMainMenu
Left = 432
Top = 248
object File2: TMenuItem
Caption = 'File'
object Open1: TMenuItem
Caption = 'Open'
end
object Exit2: TMenuItem
Caption = 'Exit'
end
end
end
end
UNIT2.dmf
==========
object Form2: TForm2
Left = 655
Top = 403
Width = 530
Height = 317
Caption = 'frmChild'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsMDIChild
OldCreateOrder = False
Position = poDefault
Visible = True
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object Edit1: TEdit
Left = 272
Top = 88
Width = 121
Height = 21
TabOrder = 0
Text = 'Edit1'
end
object Memo1: TMemo
Left = 16
Top = 152
Width = 185
Height = 89
Lines.Strings = (
'Memo1')
TabOrder = 1
end
object Button1: TButton
Left = 232
Top = 144
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 2
OnClick = Button1Click
end
end
UNIT3.dfm
=========
object Form3: TForm3
Left = 270
Top = 187
Width = 546
Height = 343
Caption = 'frmLogin'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 240
Top = 160
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
end
UNIT1.pas
=========
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TfrmMDI = class(TForm)
MainMenu1: TMainMenu;
File1: TMenuItem;
New1: TMenuItem;
Exit1: TMenuItem;
MainMenu2: TMainMenu;
File2: TMenuItem;
Open1: TMenuItem;
Exit2: TMenuItem;
procedure Exit1Click(Sender: TObject);
procedure New1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMDI: TfrmMDI;
implementation
uses Unit2, Unit3;
{$R *.dfm}
procedure TfrmMDI.Exit1Click(Sender: TObject);
begin
close;
end;
procedure TfrmMDI.New1Click(Sender: TObject);
var Child : TForm2;
begin
child := Tform2.Create(self);
child.Show;
end;
procedure TfrmMDI.FormCreate(Sender: TObject);
begin
form3.showmodal;
end;
procedure TfrmMDI.FormActivate(Sender: TObject);
begin
unit3.Form3.showmodal;
end;
end.
UNIT2.pas
=========
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
//TCloseEvent = procedure Button1Click(Sender: TObject);
//TCloseAction = (caNone, caHide, caFree, caMinimize);
//TCloseEvent = procedure (Sender: TObject; Var Action : TCloseAction);
//property OnClose:TCloseEvent
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action := cafree
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
//TForm2.FormClose(self);
end;
end.
UNIT3.pas
=========
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
if frmmdi = null then frmmdi:= unit1.TfrmMDI.Create(application);
close;
end;
end.
Again I appriciate your help. Thank you very much.
Have A Great Day!!
--Nick