home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / www / afc / afc-dir / reqtooller_examples.lha / Examples / ReqTooller_Example1.e < prev   
Text File  |  1997-09-09  |  3KB  |  114 lines

  1. /*
  2.  
  3.   $VER: ReqTooller Example 1 - (C)Copyright Amiga Foundation Classes
  4.  
  5.   Written By: Fabio Rotondo
  6.  
  7.   This code is Public Domain
  8.  
  9.  
  10. */
  11.  
  12. MODULE 'afc/reqtooller', 'afc/explain_exception'
  13.  
  14. PROC main() HANDLE
  15.   DEF rt=NIL:PTR TO reqtooller
  16.   DEF s:PTR TO CHAR
  17.  
  18.   NEW rt.reqtooller()          -> First of all, we init the class.
  19.  
  20.   -> Here we set the default title and path
  21.   rt.setattrs([RT_TITLE, 'reqtooller Example',
  22.                RT_PATH, 'Ram:',
  23.                NIL, NIL])
  24.  
  25.  
  26.  
  27.   /*
  28.       Here we open a SAVE requester
  29.       Please, note the RT_FULLNAME set to TRUE:
  30.       when we'll do a get(RT_FILENAME) the filename returned will contain
  31.       also the path.
  32.   */
  33.   rt.req(RTREQ_SAVE, [RT_OKGAD, '_Save', RT_FULLNAME, TRUE, NIL])
  34.   WriteF('Path:\s\n', rt.get(RT_PATH))
  35.   WriteF('FullName:\s\n', rt.get(RT_FILENAME))
  36.  
  37.  
  38.   -> Hey! Here there is a path requester!
  39.   -> (Here we change the OK gadget, because it would remain "Save"...)
  40.   rt.req(RTREQ_PATH, [RT_OKGAD, 'Ok', NIL, NIL])
  41.   WriteF('NEW Path:\s\n', rt.get(RT_PATH))
  42.  
  43.  
  44.   -> And here a Volumes requester!
  45.   rt.req(RTREQ_VOLUMES, NIL)
  46.  
  47.  
  48.   -> And what about a MultiFile requester?
  49.   rt.req(RTREQ_MULTI, NIL)
  50.  
  51.   /*
  52.       This is the right routine to scan throught all
  53.       the files selected.
  54.       Please, note that we have still the RT_FULLNAME flag set.
  55.       So the names returned will contain full path.
  56.   */
  57.   WHILE (s:=rt.get(RT_MULTINEXT))
  58.     WriteF('Name:\s\n', s)
  59.   ENDWHILE
  60.  
  61.  
  62.   -> Wow a font requester
  63.   rt.req(RTREQ_FONT, NIL)
  64.  
  65.  
  66.   -> And a font requester supporting color fonts :-)
  67.   rt.req(RTREQ_COLFONT, [RT_FONTNAME, 'XHelvetica.font', NIL])
  68.   WriteF('FontName:\s\n', rt.get(RT_FONTNAME))
  69.  
  70.   -> Look: the EasyReq returns a value, we get it!
  71.   WriteF('EasyReq result:\d\n', rt.req(RTREQ_EASY, [RT_TEXT,    'Do You Like This Requester?',
  72.                                                     RT_GADS,    'Yes!|Hmmm...|No',
  73.                                                     RT_CHOICE,  2,
  74.                                                     NIL, NIL]))
  75.  
  76.  
  77.   -> A Standard Screen Requester
  78.   rt.req(RTREQ_SCREEN)
  79.   WriteF('ModeID:\h\n', rt.get(RT_SCRID))
  80.  
  81.   -> And a ALL resolutions screen requester
  82.   rt.req(RTREQ_ALLSCREEN)
  83.  
  84.   -> A String Requester (also this requester returns a value...
  85.   WriteF('STRING Result:\d\n', rt.req(RTREQ_STRING, [RT_DEFSTR, 'Hello!',
  86.                         RT_MAXCHARS,   10,
  87.                         RT_TEXT, 'Insert Your Name',
  88.                         RT_GADS, 'This is|I do not want',
  89.                        NIL]))
  90.  
  91.   -> A number requester
  92.   rt.req(RTREQ_NUMBER, [RT_MINVAL, 10, RT_MAXVAL, 20, RT_DEFVAL, 11, NIL])
  93.  
  94.  
  95.   -> An example of EasyRequester with arguments.
  96.   rt.req(RTREQ_EASY, [RT_TEXT, 'My name is:\s \s.',
  97.                       RT_ARGS, ['Fabio', 'Rotondo'],
  98.                       RT_GADS, 'Ok',
  99.                       NIL])
  100.  
  101.   -> A Message requester...
  102.   rt.req(RTREQ_MESSAGE, NIL)
  103.  
  104.   -> That will be there for 1 second.
  105.   Delay(50)
  106.  
  107. EXCEPT DO
  108.  
  109.   explain_exception()
  110.   END rt
  111.   CleanUp(0)
  112. ENDPROC
  113.  
  114.