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

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <owl.h>
  4. #include <window.h>
  5. #include <static.h>
  6. #include <combobox.h>
  7. #include <array.h>
  8. #include <string.h>
  9.  
  10. const WORD ID_COMBOBOX = 102;
  11. const int TheTextLen = 21;
  12.  
  13. class TTestApp : public TApplication
  14. {
  15. public:
  16.   TTestApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  17.     LPSTR lpCmdLine, int nCmdShow) :
  18.     TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  19.   virtual void InitMainWindow();
  20. };
  21.  
  22.  
  23. class TCBoxWindow : public TWindow
  24. {
  25. public:
  26.   PTComboBox ComboBox;
  27.   PTComboBoxData ComboBoxData;
  28.  
  29.   TCBoxWindow(PTWindowsObject AParent, LPSTR ATitle);
  30.   ~TCBoxWindow();
  31. };
  32.  
  33. TCBoxWindow::TCBoxWindow(PTWindowsObject AParent, LPSTR ATitle) :
  34.   TWindow(AParent, ATitle)
  35. {
  36.   ComboBox = new TComboBox(this, ID_COMBOBOX, 190, 30, 150, 100,
  37.     CBS_SIMPLE, TheTextLen);
  38.   ComboBox->EnableTransfer();
  39.   ComboBoxData = new TComboBoxData();
  40.   ComboBoxData->AddString("a");
  41.   ComboBoxData->AddString("b");
  42.   ComboBoxData->AddString("c", TRUE);
  43.   ComboBoxData->AddString("d");
  44.   ComboBoxData->AddString("e");
  45.   ComboBoxData->AddString("f");
  46.   TransferBuffer = &ComboBoxData;
  47.   EnableKBHandler();
  48. }
  49.  
  50. TCBoxWindow::~TCBoxWindow()
  51. {
  52.   delete ComboBoxData;
  53. }
  54.  
  55. void TTestApp::InitMainWindow()
  56. {
  57.   MainWindow = new TCBoxWindow(NULL, Name);
  58. }
  59.  
  60. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  61.   LPSTR lpCmdLine, int nCmdShow)
  62. {
  63.   TTestApp TestApp("Combo Box Transfer Tester", hInstance, hPrevInstance,
  64.     lpCmdLine, nCmdShow);
  65.   TestApp.Run();
  66.   return(TestApp.Status);
  67. }
  68.