home *** CD-ROM | disk | FTP | other *** search
- #include <osbind.h>
- #include "libs.h"
- #include "popup.h"
-
- Library PopupLibBase; /* points to popup menu library */
-
- Value
- beep(handle,i)
- {
- Bconout(2,7);
- return(42);
- }
-
- help(handle,i,str)
- char *str;
- {
- char out[256];
-
- sprintf(out,"[0][ If you select | '%s' | you'll hear the bell ][ OK ]",
- str);
- FormAlert(1,out);
- }
-
- main ()
- {
- menu test_menu;
- menu sub_menu;
- Value result;
- char out[80];
- char out_str[256];
-
- if (InitLibSupport()) {
- if (PopupLibBase = (Library)
- FindLibrary(POPUP_LIB,POPUP_VERSION)) {
- sprintf(out_str,"[3][ Library | '%s' ][ 0x%08X ]",
- POPUP_LIB,PopupLibBase);
- FormAlert(1,out_str);
- ConfigRows(2);
- sub_menu =
- DefineMenu(" Submenu %s%t| five %v| Beep %h%f",
- 5,help,beep);
- test_menu =
- DefineMenu(" test %s%t| one | two | Submenu %o%m",
- sub_menu);
- result = DoMenu(test_menu);
- out[0] = '\0';
- switch(result) {
- case -2 : strcat(out,"cancelled");
- case -1 : strcat(out,"| no selection"); break;
- default : sprintf(out,"you selected %d",result);
- }
- sprintf(out_str,"[0][ %s ][ OK ]",out);
- FormAlert(1,out_str);
- FreeMenu(test_menu);
- FreeMenu(sub_menu);
- exit(0);
- } else {
- printf("PopupLib not available\n");
- }
- } else printf("no library support\n");
- exit(1);
- }
-