home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 7.ddi / OWLDEMOS.ZIP / GBOXTEST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  3.2 KB  |  102 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <owl.h>
  6. #include <radiobut.h>
  7. #include <groupbox.h>
  8. #include <static.h>
  9.  
  10. const int ID_BCCGROUP = 100;
  11. const int ID_BCC1 = 101;
  12. const int ID_BCC5  = 102;
  13. const int ID_BCC10 = 103;
  14. const int ID_BCCX  = 104;
  15. const int ID_CPPGROUP = 110;
  16. const int ID_CPP1 = 111;
  17. const int ID_CPP5  = 112;
  18. const int ID_CPP10 = 113;
  19. const int ID_CPPX  = 114;
  20. const int ID_PLACEBUTTON = 131;
  21. const int ID_CANCELBUTTON = 132;
  22.  
  23. class TOrderApp : public TApplication
  24. {
  25. public:
  26.   TOrderApp(LPSTR Name, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  27.     LPSTR lpCmdLine, int nCmdShow)
  28.     : TApplication(Name, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  29.   virtual void InitMainWindow();
  30. };
  31.  
  32. class TOrderWindow : public TWindow
  33. {
  34. public:
  35.   PTGroupBox BCCGroup;
  36.   PTGroupBox CPPGroup;
  37.  
  38.   TOrderWindow(PTWindowsObject AParent, LPSTR ATitle);
  39.   virtual void HandleBCCGroupMsg(TMessage& Msg) =
  40.     [ID_FIRST + ID_BCCGROUP];
  41.   virtual void HandleCPPGroupMsg(TMessage& Msg) =
  42.     [ID_FIRST + ID_CPPGROUP];
  43.  };
  44.  
  45. TOrderWindow::TOrderWindow(PTWindowsObject AParent, LPSTR ATitle)
  46.   : TWindow(AParent, ATitle)
  47. {
  48.   PTRadioButton TmpRB;
  49.   Attr.X = 20;
  50.   Attr.Y = 5;
  51.   Attr.W = 380;
  52.   Attr.H = 260;
  53.   new TStatic(this, -1, "Borland C++ now includes an extensive Windows",
  54.     20, 10, 380, 15, 55);
  55.   new TStatic(this, -1, "class library and a complete toolkit for Windows",
  56.     20, 27, 380, 15, 45);
  57.   new TStatic(this, -1, "resource editing.", 20, 44, 380, 15, 55);
  58.   new TStatic(this, -1, "              How many copies would you like?",
  59.     10, 61, 380, 15, 35);
  60.   BCCGroup = new TGroupBox(this, ID_BCCGROUP, "BCC Compiler",
  61.     20, 80, 150, 105);
  62.   TmpRB = new TRadioButton(this, ID_BCC1, "1", 30, 100, 40, 17, BCCGroup);
  63.   TmpRB->Attr.Style |= WS_TABSTOP;
  64.   new TRadioButton(this, ID_BCC5, "5", 30, 120, 40, 17, BCCGroup);
  65.   new TRadioButton(this, ID_BCC10, "10", 30, 140, 40, 17, BCCGroup);
  66.   new TRadioButton(this, ID_BCCX, "X", 30, 160, 40, 17, BCCGroup);
  67.   CPPGroup = new TGroupBox(this, ID_CPPGROUP, "Professional Packs",
  68.     189, 80, 150, 105);
  69.   TmpRB = new TRadioButton(this, ID_CPP1, "1", 200, 100, 40, 17, CPPGroup);
  70.   TmpRB->Attr.Style |= WS_TABSTOP;
  71.   new TRadioButton(this, ID_CPP5, "5", 200, 120, 40, 17, CPPGroup);
  72.   new TRadioButton(this, ID_CPP10, "10", 200, 140, 40, 17, CPPGroup);
  73.   new TRadioButton(this, ID_CPPX, "X", 200, 160, 40, 17, CPPGroup);
  74.   new TButton(this, ID_PLACEBUTTON, "PLACE ORDER", 20, 195, 157, 25, FALSE);
  75.   new TButton(this, ID_CANCELBUTTON, "CANCEL ORDER", 181, 195, 157, 25, FALSE);
  76.   EnableKBHandler();
  77. }
  78.  
  79. void TOrderWindow::HandleBCCGroupMsg(TMessage&)
  80. {
  81.   MessageBox(HWindow, "Delivery will take 1 week", Title, MB_OK);
  82. }
  83.  
  84. void TOrderWindow::HandleCPPGroupMsg(TMessage&)
  85. {
  86.   MessageBox(HWindow, "Delivery will take 2 weeks", Title, MB_OK);
  87. }
  88.  
  89. void TOrderApp::InitMainWindow()
  90. {
  91.   MainWindow = new TOrderWindow(NULL, Name);
  92. }
  93.  
  94. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  95.   LPSTR lpCmdLine, int nCmdShow)
  96. {
  97.   TOrderApp OrderApp("BCC Order Form", hInstance, hPrevInstance,
  98.     lpCmdLine, nCmdShow);
  99.   OrderApp.Run();
  100.   return OrderApp.Status;
  101. }
  102.