home *** CD-ROM | disk | FTP | other *** search
- #include "cwldemo.h"
-
- int WinChild(POPUP_MENU_PTR p, int sel)
- {
- #ifndef SHWARE
- char buf[15];
- WPOINTER cw;
- int i,j,k;
- cw = WindowInitialize(DESKTOP_WINDOW,
- BORDER,0,0,40,4,
- BLACKONCYAN,BLACKONCYAN,SINGLEBOX);
- WindowWriteCenterString(cw,"You can create child windows...",0);
- WindowCenter(cw,VERTCENTER | HORIZCENTER);
- WindowDisplay(cw,1,NOEFFECT);
- delay_approx(5000);
- /* WindowHide(cw,NOEFFECT);*/
-
- /* Create Parent */
- wTemp[0] = WindowInitialize(DESKTOP_WINDOW, BORDER, 0, 0, 37, 15,
- 0x70, 0x70, DOUBLEBOX);
-
- wTemp[1] = WindowInitialize(wTemp[0], BORDER, 0, 0, 10, 1,
- 0x70, 0x70, SINGLEBOX);
-
- wTemp[2] = WindowInitialize(wTemp[0], BORDER, 0, 25, 10, 1,
- 0x70, 0x70, SINGLEBOX);
-
- wTemp[3] = WindowInitialize(wTemp[0], BORDER, 10, 0, 10, 1,
- 0x70, 0x70, SINGLEBOX);
-
- wTemp[4] = WindowInitialize(wTemp[0], BORDER, 10, 25, 10, 1,
- 0x70, 0x70, SINGLEBOX);
-
- /* Create children */
- for (i = 1; i <=4; i++)
- {
- sprintf(buf,"Child %d",i);
- WindowWriteCenterString(wTemp[i],buf,0);
- }
- WindowCenter(wTemp[0],VERTCENTER | HORIZCENTER);
- WindowDisplay(wTemp[0],1,NOEFFECT);
- delay_approx(5000);
- /* WindowDisplay(cw,1,NOEFFECT);*/
- WindowDisplay(cw,1,NOEFFECT);
- WindowClear(cw);
- WindowWriteString(cw, "These four child windows are",0,0);
- WindowWriteString(cw, "dependent of the parent window",1,0);
- WindowWriteString(cw, "Press a key to slide these windows",2,0);
- GET_KEY();
-
- WindowWriteString(cw, "Press ESCAPE to stop... ",2,0);
-
- while (!ISKEYREADY())
- {
- i = rand() % 4; /* Window */
- j = rand() % 15; /* row */
- k = rand() % 37; /* column */
- WindowMove(wTemp[i + 1], j, k);
- delay(50);
- }
- FLUSH_KEYBOARD();
-
- WindowClose(wTemp[0],NOEFFECT);
- WindowClose(cw,NOEFFECT);
- #else
- NotAvailable( );
- #endif
- return POPUP_CONTINUE;
-
- }