home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / HP95_100 / P_GRAMG / HPCLIB / DEMO2.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-03  |  3.8 KB  |  135 lines

  1. /*****************************
  2. * HP100LX WINDOW ENVIRONMENT *
  3. *       Demo  program        *
  4. *       August 3,1994        *
  5. *     by: Harry Konstas      *
  6. *****************************/
  7.  
  8. #include "hpclib.h"
  9.  
  10. /* Environment Variable declarations */
  11.  
  12.  
  13. TOPMESSAGE ="                HP100LX Graphics Environment Example.";
  14.  
  15. MENUBARMSG ="File  Edit  Search  Quit  Help ";
  16.  
  17. MENUITEMS ={
  18.  
  19. /* menu1 */ {"Load   F2","Save  F10"},
  20. /* menu2 */ {"Edit   F3","Insert F4","Delete F5"},
  21. /* menu3 */ {"Quit   F8"},
  22. /* menu4 */ {"Help   F1","About"}};
  23.  
  24. KEYLABELS={
  25.  
  26. " Help   Find    Next   Last   "
  27. " All    Edit    Add    Quit   "
  28. " PgUp   PgDn  "};
  29.  
  30.  
  31. #include "hpwenv.c"  /* remove when library is created  */
  32.  
  33.  
  34. /* Demo program variable declarations */
  35.  
  36. char message[]="The HP100LX palmtop is amazing!";
  37.  
  38.  
  39. /***************
  40. * MAIN PROGRAM *
  41. ***************/
  42.  
  43. main()
  44.  
  45. {
  46.     int f,optnum;
  47.  
  48. /* Initialisation */
  49.  
  50.     is100();                /* Is it an HP100LX? */
  51.     setgra();               /* Set graphics mode */
  52.     announ(AN_LEFT);        /* place announciators left */
  53.     toplin(topmes);         /* Create top line */
  54.     botlin(botmes);         /* Create bottom (key-label) line */
  55.     setfon(LARGE_FONT);     /* set text to large font */
  56.  
  57.     wrtext(65,20,"Welcome to the HP100LX palmtop.");
  58.  
  59.     line(0,35,639,35);      /* draw a line */
  60.     setfon(SMALL_FONT);     /* set text to small font */
  61.  
  62.     for (f=0;f<12;f++)
  63.     {
  64.         wrtext(20,40+(f*12),message);
  65.         wrtext(360,40+(f*12),message);
  66.     }
  67.  
  68.  
  69. /* Demo starts here  */
  70.  
  71.     open_win(1,50,50,450,120,"Demo window"); /* open window#1 */
  72.     wrtext(140,80,"You can open windows..."); /* write message in window */
  73.  
  74.     sleep(3);                   /* wait 5 seconds */
  75.  
  76.     open_win(2,80,80,330,180,"Window #2");   /* open window#2 */
  77.     wrtext(90,120,"You can also do menus");   /* write message in window */
  78.  
  79.     sleep(3);                   /* wait 5 seconds           */
  80.  
  81.     close_win(2);               /* close window #2          */
  82.     click();                    /* click + delay            */
  83.     close_win(1);               /* close window #2          */
  84.     click();
  85.  
  86.     open_mbar();                /* open menu bar            */
  87.     sleep(1);
  88.  
  89.     sel_menu(1);                /* select menu #1           */
  90.     click();
  91.     sel_menu(1);                /* unselect menu #1         */
  92.  
  93.     sel_menu(2);                /* select menu #2           */
  94.     optnum=open_menu(2);        /* open menu #2             */
  95.                                 /* optnum=#of items in menu */
  96.  
  97.     sel_opt(1);                 /* select 1st item in menu  */
  98.     click();                    /* just a click + delay     */
  99.     sel_opt(1);                 /* unselect 1st item        */
  100.  
  101.     sel_opt(2);                 /* select 2nd item in menu  */
  102.     click();                    /* click + delay            */
  103.     sel_opt(2);                 /* unselect 2nd item        */
  104.  
  105.     sel_opt(3);                 /* select 3rd item in menu  */
  106.     click();                    /* click + delay            */
  107.     sel_opt(3);                 /* unselect 3rd item        */
  108.  
  109.     close_menu();               /* close menu               */
  110.     click();                    /* click + delay            */
  111.     close_mbar();               /* close menu bar           */
  112.     click();
  113.  
  114.     errwin("That's all! Press a key.");  /* error window demo */
  115.  
  116.  
  117.     sleep(1);
  118.     announ(AN_RIGHT);            /* Place announciators right */
  119.     setmda();                    /* Set screen mode to text mode */
  120.     exit(0);                     /* Exit program */
  121. }
  122.  
  123.  
  124. /***************
  125. * WINDOW CLICK * < Used to slow things down...
  126. ***************/
  127.  
  128. click()
  129.  
  130. {
  131.     sound(30,1);
  132.     sleep(1);
  133. }
  134.  
  135.