home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / c / cwl30 / cwl3demo / cwlfunc7.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-05  |  2.0 KB  |  71 lines

  1. #include "cwldemo.h"
  2.  
  3. int WinChild(POPUP_MENU_PTR p, int sel)
  4. {
  5. #ifndef SHWARE
  6.   char buf[15];
  7.   WPOINTER cw;
  8.   int i,j,k;
  9.   cw = WindowInitialize(DESKTOP_WINDOW,
  10.                         BORDER,0,0,40,4,
  11.                         BLACKONCYAN,BLACKONCYAN,SINGLEBOX);
  12.   WindowWriteCenterString(cw,"You can create child windows...",0);
  13.   WindowCenter(cw,VERTCENTER | HORIZCENTER);
  14.   WindowDisplay(cw,1,NOEFFECT);
  15.   delay_approx(5000);
  16. /*  WindowHide(cw,NOEFFECT);*/
  17.  
  18.   /* Create Parent */
  19.   wTemp[0] = WindowInitialize(DESKTOP_WINDOW, BORDER, 0, 0, 37, 15,
  20.                               0x70, 0x70, DOUBLEBOX);
  21.  
  22.   wTemp[1] = WindowInitialize(wTemp[0], BORDER, 0, 0, 10, 1,
  23.                               0x70, 0x70, SINGLEBOX);
  24.  
  25.   wTemp[2] = WindowInitialize(wTemp[0], BORDER, 0, 25, 10, 1,
  26.                               0x70, 0x70, SINGLEBOX);
  27.  
  28.   wTemp[3] = WindowInitialize(wTemp[0], BORDER, 10, 0, 10, 1,
  29.                               0x70, 0x70, SINGLEBOX);
  30.  
  31.   wTemp[4] = WindowInitialize(wTemp[0], BORDER, 10, 25, 10, 1,
  32.                               0x70, 0x70, SINGLEBOX);
  33.  
  34.   /* Create children */
  35.   for (i = 1; i <=4; i++)
  36.   {
  37.     sprintf(buf,"Child %d",i);
  38.     WindowWriteCenterString(wTemp[i],buf,0);
  39.   }
  40.   WindowCenter(wTemp[0],VERTCENTER | HORIZCENTER);
  41.   WindowDisplay(wTemp[0],1,NOEFFECT);
  42.   delay_approx(5000);
  43. /*  WindowDisplay(cw,1,NOEFFECT);*/
  44.   WindowDisplay(cw,1,NOEFFECT);
  45.   WindowClear(cw);
  46.   WindowWriteString(cw, "These four child windows are",0,0);
  47.   WindowWriteString(cw, "dependent of the parent window",1,0);
  48.   WindowWriteString(cw, "Press a key to slide these windows",2,0);
  49.   GET_KEY();
  50.  
  51.   WindowWriteString(cw, "Press ESCAPE to stop...           ",2,0);
  52.  
  53.   while (!ISKEYREADY())
  54.   {
  55.     i = rand() % 4;  /* Window */
  56.     j = rand() % 15; /* row */
  57.     k = rand() % 37; /* column */
  58.     WindowMove(wTemp[i + 1], j, k);
  59.     delay(50);
  60.   }
  61.   FLUSH_KEYBOARD();
  62.  
  63.   WindowClose(wTemp[0],NOEFFECT);
  64.   WindowClose(cw,NOEFFECT);
  65. #else
  66.   NotAvailable( );
  67. #endif
  68.   return POPUP_CONTINUE;
  69.  
  70. }
  71.