12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- {
- $Id$
- Using an asl.library requester
- Free Pascal for MorphOS example
- Copyright (C) 2005 by Karoly Balogh
- Based on work of Nils Sjoholm
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- { * 2005.01.30 * }
- { * Needs MorphOS RTL 2005.01.30 or later! * }
- program ASLtest;
- uses exec, intuition, utility, asl;
- function MessageBox(title, txt, gad: String) : LongInt;
- var
- tmpReq: TEasyStruct;
- begin
- title:=title+#0;
- txt:=txt+#0;
- gad:=gad+#0;
- with tmpReq do begin
- es_StructSize:=SizeOf(tEasyStruct);
- es_Flags:=0;
- es_Title:=@title[1];
- es_TextFormat:=@txt[1];
- es_GadgetFormat:=@gad[1];
- end;
- MessageBox:=EasyRequestArgs(NIL,@tmpReq,NIL,NIL);
- end;
- var
- FileReq : PFileRequester;
- aslResult: Boolean;
- begin
- { * Opening needed libraries * }
- InitIntuitionLibrary;
- InitAslLibrary;
- FileReq:=AllocAslRequestTags(ASL_FileRequest,[
- ASLFR_InitialPattern,DWord(PChar('#?')),
- ASLFR_TitleText,DWord(PChar('ASL Requester Test')),
- ASLFR_DoPatterns,DWord(True),
- TAG_DONE]);
- if FileReq<>NIL then begin
- aslResult:=AslRequest(FileReq,NIL);
- if aslResult then
- MessageBox('ASL Test Results',
- 'The path is: '+FileReq^.rf_Dir+#10+
- 'And the file is: '+FileReq^.rf_File,
- 'OK')
- else
- MessageBox('ASL Test Result',
- 'You canceled!',
- 'OK');
- FreeAslRequest(FileReq);
- end;
- end.
- {
- $Log$
- Revision 1.1 2005-01-30 20:03:43 karoly
- * initial revision
- }
|