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

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITString.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. CITString    stringInput;
  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 Bevel Text");
  35.       winGroup.InsObject(stringInput,Error);
  36.         stringInput.LabelText("Type a text:");
  37.         stringInput.LabelJustification(LJ_RIGHT);
  38.         stringInput.TextVal("Start");
  39.         stringInput.MinVisible(10);
  40.         stringInput.MaxChars(20);
  41.       winGroup.InsObject(quitButton,Error);
  42.         quitButton.Text("Quit");
  43.         quitButton.EventHandler(QuitEvent);
  44.  
  45.   Application.InsObject(DemoScreen,Error);
  46.  
  47.   // Ok?
  48.   if( Error )
  49.     return 10;
  50.  
  51.   Application.Run();
  52.  
  53.   return 0;
  54. }
  55.  
  56. void QuitEvent(ULONG ID)
  57. {
  58.   Application.Stop();
  59. }
  60.  
  61. int repeatCount = 0;
  62.  
  63. void CloseEvent()
  64. {
  65.   char* text;
  66.  
  67.   repeatCount++;
  68.  
  69.   switch( repeatCount )
  70.   {
  71.     case 1:
  72.       stringInput.TextVal("Hello!");
  73.       break;
  74.     case 2:
  75.       text = stringInput.TextVal();
  76.       break;
  77.     default:
  78.       Application.Stop();
  79.     break;
  80.   }
  81. }
  82.