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

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITRadioButton.h>
  4.  
  5. #include <stdlib.h>
  6.  
  7. CITApp Application;
  8.  
  9. CITWorkbench   DemoScreen;
  10. CITWindow      DemoWindow;
  11. CITVGroup      winGroup;
  12. CITRadioButton rb;
  13. CITButton      quitButton;
  14.  
  15. char* text[] = {"300","600","1200","2400","4800","9600",NULL};
  16.  
  17. void CloseEvent();
  18. void QuitEvent(ULONG ID);
  19.  
  20. int main(void)
  21. {
  22.   BOOL Error=FALSE;
  23.  
  24.   DemoScreen.InsObject(DemoWindow,Error);
  25.     DemoWindow.Position(WPOS_CENTERSCREEN);
  26.     DemoWindow.CloseGadget();
  27.     DemoWindow.DragBar();
  28.     DemoWindow.SizeGadget();
  29.     DemoWindow.DepthGadget();
  30.     DemoWindow.IconifyGadget();
  31.     DemoWindow.Activate();
  32.     DemoWindow.Caption("CITRadioButton Test");
  33.     DemoWindow.CloseEventHandler(CloseEvent);
  34.     DemoWindow.InsObject(winGroup,Error);
  35.       winGroup.SpaceOuter();
  36.       winGroup.InsObject(rb,Error);
  37.         rb.Labels(text);
  38.       winGroup.InsObject(quitButton,Error);
  39.         quitButton.Text("Quit");
  40.         quitButton.MaxHeight(20);
  41.         quitButton.EventHandler(QuitEvent);
  42.  
  43.   Application.InsObject(DemoScreen,Error);
  44.  
  45.   // Ok?
  46.   if( Error )
  47.     return 10;
  48.  
  49.   Application.Run();
  50.  
  51.   return 0;
  52. }
  53.  
  54. void QuitEvent(ULONG ID)
  55. {
  56.   Application.Stop();
  57. }
  58.  
  59.  
  60. int repeatCount = 0;
  61.  
  62. void CloseEvent()
  63. {
  64.   int num;
  65.  
  66.   repeatCount++;
  67.  
  68.   switch( repeatCount )
  69.   {
  70.     case 1:
  71.       rb.Selected(3);
  72.       break;
  73.     case 2:
  74.       num = rb.Selected();
  75.       break;
  76.     default:
  77.       Application.Stop();
  78.     break;
  79.   }
  80. }
  81.