home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
rks_dd
/
_SETUP.1
/
ClientOle.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-08-23
|
3KB
|
127 lines
unit ClientOle;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Button2: TButton;
Button3: TButton;
OpenDialog1: TOpenDialog;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
des:variant; // Cely program
proj:variant; // Jeden projekt
end;
var
Form1: TForm1;
implementation
uses {oleauto}comobj;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
des := CreateOleObject('rkscase.command');
// spustim OLE Automation server, a ziskam jeho Variant promennou "des"
end;
// Tahle procedura ukazuje, jak se vytahnou informace z modelu
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
n:integer;
atr:variant;
ent:variant;
rel:variant;
begin
IF opendialog1.execute then
begin
proj := des.LoadModelFromFile(OpenDialog1.FileName);
// Nahraji model z disku, a ziskam jeho Variant promennou "proj"
listbox1.items.clear;
n := proj.atribcount; // pocet atributu v modelu
for i := 0 to n-1 do
begin
atr := proj.atrib(i);
listbox1.items.add(format('%s %s',[atr.name,proj.DatType(atr.oid)]));
end;
listbox1.items.add('--');
listbox1.items.add('Seznam Entit');
listbox1.items.add('--');
n := proj.Entcount; // pocet entit v modelu
for i := 0 to n-1 do
begin
ent := proj.ent(i);
listbox1.items.add(ent.name);
end;
listbox1.items.add('--');
listbox1.items.add('Seznam relaci');
listbox1.items.add('--');
n := proj.RelCount; // pocet relaci v modelu
for i := 0 to n-1 do
begin
rel := proj.rel(i);
listbox1.items.add(rel.name);
end;
proj := unassigned; // pro jistotu
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
des.exit; // Ukonceni serveru
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
des.tile; // Zarovnani oken do dlazdic
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
des.cascade; // Zarovnani oken do kaskady
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
des.show; // Zobrazeni CASE
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
des.hide; // Ukryti CASE, zbyva jen tray icona vpravo dole
end;
end.