{
Test program for Pascal Interface to Nico Francois's Reqtools.library

Copyright 1992 Richard Waspe
}

program ReqTest;
Uses Exec, Crt, Reqtools, Dos, Utility, Intuition, Graphics;

Var	FileReq	:	^rtFileRequester;
		FontReq	:	^rtFontRequester;
		InfoReq	:	^rtReqInfo;
		MyHook	:	tHook;
		pTitle	:	pCString;
		pFilename : pCString;
		pReqTitle	:	pCString;
		pGadgText	:	pCString;
		pScrTitle : pCString;
		LongNum, Ret, Color : LongInt;
		dump : LongInt;
		a,b : Cstring;
		MyNewScreen : pNewScreen;
		MyScreen : pScreen;
		OK	:	Boolean;
		retcode  :  Longint;
		fname : string[255];
		apointer  :  Pointer;
begin

IntuitionBase := pIntuitionBase(OpenLibrary('intuition.library', 33));
If IntuitionBase = NIL Then
	Begin
	Writeln('Unable to open IntuitionLibrary');
	Delay(3000);
	Exit
	End;	

ReqToolsBase := pReqToolsBase(OpenLibrary('reqtools.library',37));
if ReqToolsBase = NIL then
	Begin
	Writeln('Unable to open ReqTools Library');
	exit
	end;

NEW(pScrTitle);
PasToC('This Is My Screen',pScrTitle^);
apointer := pScrTitle;   
NEW(MyNewScreen);
with MyNewScreen^ do
	Begin
   LeftEdge 	:=	0;
   TopEdge		:= 0;
   Width 		:= 640;
   Height 		:= 512;
   Depth 		:= 2;
   DetailPen 	:= 0;
   BlockPen 	:= 1;
   ViewModes	:= HIRES OR LACE;
   Type_			:= CUSTOMSCREEN;
   Font			:= NIL;
   DeFaultTitle := apointer;
   Gadgets		:=	NIL;
   CustomBitMap := NIL;
   End;

MyScreen	:=	OpenScreen(MyNewScreen);

   
NEW(pReqTitle);
NEW(pGadgText);
PasToC('Hello there, this is a requester',pReqTitle^);
PasToC('Ok then ?',pGadgText^);
InfoReq := rtAllocRequestA(RT_REQINFO, NIL);
ret := rtEZRequestA(pReqTitle, pGadgText, inforeq, NIL, NIL);
delay(500);
PasToC('Volume dh0: has a Read/Write Error',pReqTitle^);
PasToC('Retry|Panic|Cancel', pGadgText^);
ret := rtEZRequestA(pReqTitle, pGadgText, inforeq, NIL, NIL);
Writeln('InfoReq returned  ',ret);


NEW(pTitle);
NEW(pFilename);
PasToC('My File Request',pTitle^);
PasToC('First_File',pFilename^);
FileReq := rtAllocRequestA(RT_FILEREQ, NIL); 
RetCode := rtFileRequestA(FileReq, pFilename, pTitle, NIL);
Writeln('FileRequest returned ',Retcode);
CToPas(FileReq^.Dir^,fname);
writeln('You chose Directory -  ',fname);
CToPaS(PFileName^,fname);
writeln ('You chose ',fname);



Delay(500);
rtFreeRequest(InfoReq);
DISPOSE(pFileName);
DISPOSE(pTitle);
DISPOSE(pScrTitle);
CloseScreen(MyScreen); 
CloseLibrary(pLibrary(ReqToolsBase));
CloseLibrary(pLibrary(IntuitionBase))
End.
  