home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 1
/
romside_best_of_german_only_1.iso
/
wissen
/
dos
/
wgraph
/
entpack.exe
/
WGBSP!.EXE
/
BSP23.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-11
|
4KB
|
171 lines
program Beispiel23;
uses GDecl,
GApp,
GDrivers,
GEvent,
GViews,
GDlg,
dos,
Graph;
const cmDialog = 101;
cmErgebnis = 102;
type TApplication=object(TApp)
procedure InitMenuBar; virtual;
procedure SetDialogData; virtual;
procedure HandleEvent; virtual;
procedure DialogWindow;
end;
PDialogWindow=^TDialogWindow;
TDialogWindow=object(TDlgWindow)
procedure SetListBox(x,y,xl,yl:integer;Bez:str25;LScroller:word); virtual;
end;
PDateiListBox=^TDateiListBox;
TDateiListBox=object(TListBox)
procedure CreateDataList;
end;
PDirListBox=^TDirListBox;
TDirListBox=object(TListBox)
procedure CreateDataList;
end;
tDialogData=record
Schalter:string[3];
DName1:string[12];
DName2:string[12];
end;
var MyProg:TApplication;
DlgData:tDialogData;
{Implementation TApplication}
procedure TApplication.InitMenuBar;
begin
Palette[1]:=#14;
Palette[5]:=#14;
Palette[4]:=#4;
Palette[12]:=#4;
MainMenu('~F~enster',0);
SubMenu('~D~ialogfenster',cmDialog,0,0,false,false);
SubMenu('~E~rgebnis',cmErgebnis,0,0,false,false);
SubMenu('E~x~it Alt-X',cmCloseApplication,0,altX,false,false);
end;
procedure TApplication.SetDialogData;
begin
with DlgData do
begin
Schalter:='TBB';
FillChar(DName1,SizeOf(DName1),' ');
DName1[0]:=#12;
FillChar(DName2,SizeOf(DName2),' ');
DName2[0]:=#12;
end;
end;
procedure TApplication.HandleEvent;
begin
Heap^.ShowHeapStatus(523,8,White);
TProgram.HandleEvent;
case Event.Command of
cmDialog : DialogWindow;
cmErgebnis : Messagebox(0,'Info',DlgData.DName1+'#'+DlgData.DName2);
end; {case}
end;
procedure TApplication.DialogWindow;
var R:TRect;
Window:PDialogWindow;
begin
R.Assign(60,80,440,360);
Window:=new(PDialogWindow, Init(R,'Beispiel 23 : Listbox',winDouble+winPanel+winMenu+winKey));
with Window^ do
begin
SetPushButton(15,40,80,22,'OK',cmCloseWindow);
SetListBox(35,100,127,144,'~L~istbox 1',VScrBar);
SetListBox(210,100,127,144,'List~b~ox 2',DScrBar);
SetData(DlgData);
end;
InsertDesktop(Window);
end;
{Implementation TDialogWindow}
procedure TDialogWindow.SetListBox(x,y,xl,yl:integer;Bez:str25;
LScroller:word);
var LBox1:PDateiListBox;
LBox2:PDirListBox;
begin
TDlgWindow.SetListBox(x,y,xl,yl,Bez,LScroller);
if pos('1',Bez)<>0 then
begin
LBox1:=new(PDateiListBox, Init(R,Bez,SBH,SBV));
LBox1^.CreateDataList;
LBox1^.P.x:=x; LBox1^.P.y:=y;
DlgList^.InsertItem(LBox1);
end
else
begin
LBox2:=new(PDirListBox, Init(R,Bez,SBH,SBV));
LBox2^.CreateDataList;
LBox2^.P.x:=x; LBox2^.P.y:=y;
DlgList^.InsertItem(LBox2);
end;
end;
{Implementation TDateiListBox}
procedure TDateiListBox.CreateDataList;
var SRec:SearchRec;
LfdPtr:PLine;
begin
FindFirst('\*.*',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-1,8,11);
end;
{Implementation TDirListBox}
procedure TDirListBox.CreateDataList;
var SRec:SearchRec;
LfdPtr:PLine;
begin
FindFirst('\*.*',Directory,SRec);
if SRec.Name<>'' then
repeat
if SRec.Attr=Directory then
begin
LfdPtr:=new(PLine, Init);
LfdPtr^.Eintrag:=SRec.Name;
Liste^.InsertItem(LfdPtr);
end;
FindNext(SRec);
until DOSError=18;
DataLen:=12;
SetLimit(12,Liste^.AnzElem-1,8,11);
end;
{--- Hauptprogramm ---}
begin
MyProg.Init('Beispiel 23');
MyProg.Run;
MyProg.Done;
end.