home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / CIT.v4 / Demo / IntegerTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  1.6 KB  |  85 lines

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITInteger.h>
  4.  
  5. #include <stdlib.h>
  6.  
  7.  
  8. CITApp Application;
  9.  
  10. CITWorkbench DemoScreen;
  11. CITWindow    DemoWindow;
  12. CITVGroup    winGroup;
  13. CITButton    quitButton;
  14. CITInteger   integerInput;
  15.  
  16. void CloseEvent();
  17. void QuitEvent(ULONG ID);
  18.  
  19. int main(void)
  20. {
  21.   BOOL Error=FALSE;
  22.  
  23.   DemoScreen.InsObject(DemoWindow,Error);
  24.     DemoWindow.Position(WPOS_CENTERSCREEN);
  25.     DemoWindow.CloseGadget();
  26.     DemoWindow.DragBar();
  27.     DemoWindow.SizeGadget();
  28.     DemoWindow.DepthGadget();
  29.     DemoWindow.IconifyGadget();
  30.     DemoWindow.Caption("CITGadgets");
  31.     DemoWindow.CloseEventHandler(CloseEvent);
  32.     DemoWindow.InsObject(winGroup,Error);
  33.       winGroup.BevelStyle();
  34.       winGroup.BevelLabel("A text");
  35.       winGroup.InsObject(integerInput,Error);
  36.         integerInput.LabelText("Type a number:");
  37.         integerInput.LabelJustification(LJ_RIGHT);
  38.         integerInput.Arrows();
  39.         integerInput.Minimum(-32);
  40.         integerInput.Maximum(32);
  41.         integerInput.Number(0);
  42.         integerInput.MinVisible(10);
  43.         integerInput.MaxChars(20);
  44.       winGroup.InsObject(quitButton,Error);
  45.         quitButton.Text("Quit");
  46.         quitButton.EventHandler(QuitEvent);
  47.  
  48.   Application.InsObject(DemoScreen,Error);
  49.  
  50.   // Ok?
  51.   if( Error )
  52.     return 10;
  53.  
  54.   Application.Run();
  55.  
  56.   return 0;
  57. }
  58.  
  59. void QuitEvent(ULONG ID)
  60. {
  61.   Application.Stop();
  62. }
  63.  
  64. int repeatCount = 0;
  65.  
  66. void CloseEvent()
  67. {
  68.   int num;
  69.  
  70.   repeatCount++;
  71.  
  72.   switch( repeatCount )
  73.   {
  74.     case 1:
  75.       integerInput.Number(27);
  76.       break;
  77.     case 2:
  78.       num = integerInput.Number();
  79.       break;
  80.     default:
  81.       Application.Stop();
  82.     break;
  83.   }
  84. }
  85.