home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 August
/
VPR9608A.BIN
/
del20try
/
install
/
data.z
/
MEMOAUTO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-05-08
|
2KB
|
98 lines
unit MemoAuto;
{ This unit implements TMemoApp, the Application automation object class for
the MemoEdit application. TMemoApp is registered as a Single Instance
automation class, thus causing a new copy of the application to be run each
time an OLE Automation controller asks for an instance of the
"MemoEdit.Application" OLE class name. TMemoApp implements the following
automated methods and properties:
function NewMemo: Variant;
Creates a new editor window and returns the window's automation object.
function OpenMemo(const FileName: string): Variant;
Loads an existing file into a new editor window and returns the window's
automation object.
procedure TileWindows;
Tiles all open editor windows.
procedure CascadeWindows;
Cascades all open editor windows.
property MemoCount: Integer;
Number of open editor windows.
property Memos[Index: Integer]: Variant;
Array of automation objects for the currently open editor windows. }
interface
uses
OleAuto;
type
TMemoApp = class(TAutoObject)
private
function GetMemo(Index: Integer): Variant;
function GetMemoCount: Integer;
automated
procedure CascadeWindows;
function NewMemo: Variant;
function OpenMemo(const FileName: string): Variant;
procedure TileWindows;
property MemoCount: Integer read GetMemoCount;
property Memos[Index: Integer]: Variant read GetMemo;
end;
implementation
uses
MainFrm, EditFrm;
procedure TMemoApp.CascadeWindows;
begin
MainForm.Cascade;
end;
function TMemoApp.GetMemo(Index: Integer): Variant;
begin
Result := TEditForm(MainForm.MDIChildren[Index]).OleObject;
end;
function TMemoApp.GetMemoCount: Integer;
begin
Result := MainForm.MDIChildCount;
end;
function TMemoApp.NewMemo: Variant;
begin
Result := MainForm.CreateMemo('').OleObject;
end;
function TMemoApp.OpenMemo(const FileName: string): Variant;
begin
Result := MainForm.CreateMemo(FileName).OleObject;
end;
procedure TMemoApp.TileWindows;
begin
MainForm.Tile;
end;
procedure RegisterMemoApp;
const
AutoClassInfo: TAutoClassInfo = (
AutoClass: TMemoApp;
ProgID: 'MemoEdit.Application';
ClassID: '{F7FF4880-200D-11CF-BD2F-0020AF0E5B81}';
Description: 'Memo Editor Application';
Instancing: acSingleInstance);
begin
Automation.RegisterClass(AutoClassInfo);
end;
initialization
RegisterMemoApp;
end.