home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 1
/
romside_best_of_german_only_1.iso
/
wissen
/
dos
/
wgraph
/
entpack.exe
/
WGDEMOQ!.EXE
/
GFILEDLG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-21
|
4KB
|
157 lines
{$A+,B-,D-,E-,F+,I-,L-,N-,O+,R-,S-,V-}
UNIT GFileDlg;
INTERFACE
USES GDecl,
GDlg,
GViews,
GEvent,
GDrivers,
dos,
graph;
const msgLoadPic = 10;
msgSavePic = 11;
type PInputDialog=^TInputDialog;
TInputDialog=object(TDlgWindow)
procedure SetDateiListBox(x,y,xl,yl:integer;Bez:str25;LScroller:word);
procedure HandleEvent; virtual;
end;
POutputDialog=^TOutputDialog;
TOutputDialog=object(TDlgWindow)
procedure HandleEvent; virtual;
end;
PDateiListBox=^TDateiListBox;
TDateiListBox=object(TListBox)
procedure CreateDataList;
end;
tDialogData=record
Schalter:string[5];
DateiName : string[32];
Datei : string[12];
end;
tImgData =record
Schalter:string[4];
DateiName:string[32];
end;
var DlgData:tDialogData;
ImgData:tImgData;
IMPLEMENTATION
{Implementation TInputDialog}
procedure TInputDialog.SetDateiListBox(x,y,xl,yl:integer;Bez:str25;
LScroller:word);
var LBox:PDateiListBox;
begin
TDlgWindow.SetListBox(x,y,xl,yl,Bez,LScroller);
LBox:=new(PDateiListBox, Init(R,Bez,SBH,SBV));
LBox^.CreateDataList;
LBox^.P.x:=x; LBox^.P.y:=y;
DlgList^.InsertItem(LBox);
end;
procedure TInputDialog.HandleEvent;
var LfdPtr:PGroup;
i:byte;
begin
TDlgWindow.HandleEvent;
with Event do
begin
if Event.Command=cmOK then
begin
Message:=msgLoadPic;
LfdPtr:=DlgList^.GetItems(1);
with PInputLine(LfdPtr)^ do
InfoString:=DlgData.DateiName;
Command:=cmCloseWindow;
end;
if Command=cmCancel then
with DlgData do
begin
DateiName:='';
Datei:='';
Command:=cmCloseWindow;
end;
if (What=evKeyboard) and (Keyb.KeyCode=kbEnter) then
if pos('*',DlgData.DateiName)<>0 then
begin
LfdPtr:=DlgList^.GetItems(2);
with PDateiListBox(LfdPtr)^ do
begin
Liste^.DeleteItems;
ChangeItem:=1;
AktivItem:=1;
Delta.X:=1; Delta.Y:=1;
VertiScrollBar^.Value:=1;
CreateDataList;
Draw;
end;
end;
if (Keyb.KeyCode=kbSpace) or Mouse.Double then
begin
Mouse.DoubleKlick:=false;
LfdPtr:=DlgList^.GetItems(2);
if PDateiListBox(LfdPtr)^.Focus then
begin
LfdPtr:=DlgList^.GetItems(1);
with PInputLine(LfdPtr)^ do
begin
Data:=DlgData.Datei;
Draw;
end;
end;
end;
end;
end;
{Implementation TOutputDialog}
procedure TOutputDialog.HandleEvent;
var LfdPtr:PGroup;
begin
TDlgWindow.HandleEvent;
if Event.Command=cmOK then
begin
Event.Message:=msgSavePic;
LfdPtr:=DlgList^.GetItems(1);
with PInputLine(LfdPtr)^ do
Event.InfoString:=ImgData.DateiName;
Event.Command:=cmCloseWindow;
end;
if Event.Command=cmCancel then
begin
ImgData.DateiName:='';
Event.Command:=cmCloseWindow;
end;
end;
{Implementation TDateiListBox}
procedure TDateiListBox.CreateDataList;
var SRec:SearchRec;
LfdPtr:PLine;
begin
FindFirst(DlgData.DateiName,Archive,SRec);
if SRec.Name<>'' then
repeat
LfdPtr:=new(PLine, Init);
LfdPtr^.Eintrag:=SRec.Name;
Liste^.InsertItem(LfdPtr);
FindNext(SRec);
until DOSError=18;
DataLen:=12;
SetLimit(12,Liste^.AnzElem,8,11);
end;
END.