home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / utility / poplibsr.arc / POPTEST.C < prev   
C/C++ Source or Header  |  1988-08-19  |  1KB  |  63 lines

  1. #include <osbind.h>
  2. #include "libs.h"
  3. #include "popup.h"
  4.  
  5. Library PopupLibBase;    /* points to popup menu library */
  6.  
  7. Value
  8. beep(handle,i)
  9. {
  10.     Bconout(2,7);
  11.     return(42);
  12. }
  13.  
  14. help(handle,i,str)
  15. char    *str;
  16. {
  17.     char    out[256];
  18.  
  19.     sprintf(out,"[0][ If you select | '%s' | you'll hear the bell ][ OK ]",
  20.         str);
  21.     FormAlert(1,out);
  22. }
  23.  
  24. main ()
  25. {
  26.     menu    test_menu;
  27.     menu    sub_menu;
  28.     Value result;
  29.     char    out[80];
  30.     char    out_str[256];
  31.  
  32.     if (InitLibSupport()) {
  33.         if (PopupLibBase = (Library)
  34.                 FindLibrary(POPUP_LIB,POPUP_VERSION)) {
  35.             sprintf(out_str,"[3][ Library | '%s' ][ 0x%08X ]",
  36.                 POPUP_LIB,PopupLibBase);
  37.             FormAlert(1,out_str);
  38.             ConfigRows(2);
  39.             sub_menu =
  40.             DefineMenu(" Submenu %s%t| five %v| Beep %h%f",
  41.                 5,help,beep);
  42.             test_menu =
  43.             DefineMenu(" test %s%t| one | two | Submenu %o%m",
  44.                 sub_menu);
  45.             result = DoMenu(test_menu);
  46.             out[0] = '\0';
  47.             switch(result) {
  48.                 case -2 : strcat(out,"cancelled");
  49.                 case -1 : strcat(out,"| no selection"); break;
  50.                 default : sprintf(out,"you selected %d",result);
  51.             }
  52.             sprintf(out_str,"[0][ %s ][ OK ]",out);
  53.             FormAlert(1,out_str);
  54.             FreeMenu(test_menu);
  55.             FreeMenu(sub_menu);
  56.             exit(0);
  57.         } else {
  58.             printf("PopupLib not available\n");
  59.         }
  60.     } else printf("no library support\n");
  61.     exit(1);
  62. }
  63.