home *** CD-ROM | disk | FTP | other *** search
- /* Simple demo using a Designer created file */
- /* Only run from CLI */
-
- #include <menudemowin.c>
-
- void main(void)
- {
- int done=0;
- ULONG class;
- UWORD code;
- struct Gadget *pgsel;
- struct IntuiMessage *imsg;
- int MenuNum;
- int ItemNum;
- if (OpenLibs()==0)
- {
- if (MakeImages()==0)
- {
- if (OpenWindowDisplayWindow()==0)
- {
- while (done==0)
- {
- Wait(1L << DisplayWindow->UserPort->mp_SigBit);
- imsg=GT_GetIMsg(DisplayWindow->UserPort);
- while (imsg != NULL )
- {
- class=imsg->Class;
- code=imsg->Code;
- pgsel=(struct Gadget *)imsg->IAddress; /* Only reference if it is a gadget message */
- GT_ReplyIMsg(imsg);
- switch (class)
- {
- case IDCMP_CLOSEWINDOW :
- done=1;
- break;
- case IDCMP_MENUPICK :
- printf("Menu Pick : ");
- while (code != MENUNULL)
- {
- printf(".");
- MenuNum = MENUNUM(code);
- ItemNum = ITEMNUM(code);
- if ((MenuNum==0) && (ItemNum==4))
- done=1;
- code = ItemAddress( DemoMenu, code)->NextSelect;
- }
- printf("\n");
- break;
- };
- imsg=GT_GetIMsg(DisplayWindow->UserPort);
- }
- }
- CloseWindowDisplayWindow();
- }
- else
- printf("Cannot open window.\n");
- FreeImages();
- }
- else
- printf("Cannot Make Images.\n");
- }
- else
- printf("Cannot open libraries.\n");
- }
-