home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 432b.lha / EzLib / doc / getyn.doc < prev    next >
Encoding:
Text File  |  1990-11-11  |  1.9 KB  |  60 lines

  1. FUNCTION   getyn()  -  get a yes or no answer using a requestor
  2.  
  3.       getyn(window, string)
  4.     struct Window *window;
  5.     char *string;
  6.  
  7.     This function will get a simple yes or no answer from a user.  You pass
  8. getyn() a string which is put into an AutoRequest().  If the user clicks
  9. o.k., TRUE is returned, otherwise FALSE.  This function is useful in many
  10. situations to just let the user know what is going on, and of course for
  11. yes/no questions.
  12.  
  13.     If you pass getyn() a NULL window pointer, it will return NULL to you.
  14. If for any reason the AutoRequest() can not be made, this function will
  15. also return NULL.  Therefore you should keep this in mind when you use
  16. getyn().  Also note that if there isn't enough memory for a full
  17. AutoRequest() (similar to the Insert Volume xxx requestors), the getyn()
  18. function will degenerate into a display alert (a recoverable guru box!).
  19. This can be scary for novice users, but only happens in *very* low memory
  20. conditions.
  21.  
  22.     The string you pass getyn() should fit horizontally on one line across
  23. the display.  If not, the AutoRequest() will not open and you will get
  24. NULL back.
  25.  
  26.     Here is an example of using getyn() to find out if the user is really a
  27. weenie:
  28.  
  29.        struct Window *wind;    /* assume it was opened earlier */
  30.        int value;
  31.  
  32.        value = getyn(wind, " Are you a weenie? ");
  33.        if (value == TRUE)
  34.      user_is_a_weenie();
  35.        else
  36.      user_is_cool();
  37.  
  38.  
  39.     Likewise, if you would just like to inform the user that something has
  40. happened or is about to happen, you can do the following:
  41.  
  42.     struct Window *wind;     /* again, assume it was opened earlier */
  43.  
  44.     /* doing some processing and something occurs */
  45.  
  46.     getyn(wind, " Did you know that XXX just happened? ");
  47.  
  48.     /* keep going .... */
  49.  
  50.  
  51.  
  52. TODO : would be nice if you could do multi-line requestors using some
  53.        sort of embedded character to signify a line break.
  54.  
  55. BUGS : None at time of publication.
  56.  
  57. SEE ALSO : getstring(); makewin(); makescreen();
  58.  
  59.  
  60.