home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / CreativeComputers.iso / shareware / text / stripansi_v1.2 / source / source.lzh / getnum.c < prev    next >
C/C++ Source or Header  |  1992-11-15  |  1KB  |  65 lines

  1. /***********************************************************************
  2.  
  3.            Get a Number routines for StripANSI v1.2
  4.  
  5.             Written by Syd L. Bolton
  6.         ⌐1992 Legendary Design Technologies Inc.
  7.  
  8.     Date:    Nov 15, 1992  Time: 12:01 am   Revision: 001
  9.  ***********************************************************************/
  10.  
  11. #include "getnum.h"
  12.  
  13. get_num()
  14. {
  15. struct IntuiMessage *message;
  16. ULONG class;
  17. int gn_exit=0;
  18.  
  19. sprintf(GNGadget1SIBuff,"%d",tabspc);
  20.  
  21. NewGNWin.TopEdge=Window->TopEdge+72;
  22. NewGNWin.LeftEdge=Window->LeftEdge+195;
  23.  
  24. if(!(GNWindow=OpenWindow(&NewGNWin))) {
  25.     return(-1);
  26.     }
  27.  
  28. ActivateGadget(&GNGadget1,GNWindow,NULL);
  29.  
  30. do {
  31.     WaitPort(GNWindow->UserPort);
  32.         while ( ( message=(struct IntuiMessage *)
  33.             GetMsg(GNWindow->UserPort) ) != NULL)
  34.         {
  35.         class=message->Class;
  36.         ReplyMsg(message); 
  37.  
  38.         if (class==GADGETUP) gn_exit=gnum_gad(message);
  39.         }
  40.     } while (gn_exit==0);
  41. CloseWindow(GNWindow);
  42. return(gn_exit);
  43. }
  44.  
  45. gnum_gad(message)
  46. struct IntuiMessage *message;
  47. {
  48. struct Gadget *igad;
  49. int gadgid;
  50.  
  51. igad=(struct Gadget *)message->IAddress;
  52. gadgid=igad->GadgetID;
  53.  
  54. switch(gadgid) {
  55.     case 1: 
  56.     case 3:    tabspc=atoi(GNGadget1SIBuff);
  57.         return(1);
  58.  
  59.     case 2: return(-1);
  60.  
  61.     default: break;
  62.     }
  63. return(0);
  64. }
  65.