asltest.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {
  2. $Id$
  3. Using an asl.library requester
  4. Free Pascal for MorphOS example
  5. Copyright (C) 2005 by Karoly Balogh
  6. Based on work of Nils Sjoholm
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. { * 2005.01.30 * }
  14. { * Needs MorphOS RTL 2005.01.30 or later! * }
  15. program ASLtest;
  16. uses exec, intuition, utility, asl;
  17. function MessageBox(title, txt, gad: String) : LongInt;
  18. var
  19. tmpReq: TEasyStruct;
  20. begin
  21. title:=title+#0;
  22. txt:=txt+#0;
  23. gad:=gad+#0;
  24. with tmpReq do begin
  25. es_StructSize:=SizeOf(tEasyStruct);
  26. es_Flags:=0;
  27. es_Title:=@title[1];
  28. es_TextFormat:=@txt[1];
  29. es_GadgetFormat:=@gad[1];
  30. end;
  31. MessageBox:=EasyRequestArgs(NIL,@tmpReq,NIL,NIL);
  32. end;
  33. var
  34. FileReq : PFileRequester;
  35. aslResult: Boolean;
  36. begin
  37. { * Opening needed libraries * }
  38. InitIntuitionLibrary;
  39. InitAslLibrary;
  40. FileReq:=AllocAslRequestTags(ASL_FileRequest,[
  41. ASLFR_InitialPattern,DWord(PChar('#?')),
  42. ASLFR_TitleText,DWord(PChar('ASL Requester Test')),
  43. ASLFR_DoPatterns,DWord(True),
  44. TAG_DONE]);
  45. if FileReq<>NIL then begin
  46. aslResult:=AslRequest(FileReq,NIL);
  47. if aslResult then
  48. MessageBox('ASL Test Results',
  49. 'The path is: '+FileReq^.rf_Dir+#10+
  50. 'And the file is: '+FileReq^.rf_File,
  51. 'OK')
  52. else
  53. MessageBox('ASL Test Result',
  54. 'You canceled!',
  55. 'OK');
  56. FreeAslRequest(FileReq);
  57. end;
  58. end.
  59. {
  60. $Log$
  61. Revision 1.1 2005-01-30 20:03:43 karoly
  62. * initial revision
  63. }