home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / object10 / bltstdlg.cpp < prev    next >
C/C++ Source or Header  |  1994-10-21  |  3KB  |  135 lines

  1. /*  Project bltest
  2.      
  3.      Copyright ⌐ 1994. All Rights Reserved.
  4.  
  5.      SUBSYSTEM:    bltest.exe Application
  6.      FILE:         bltstdlg.cpp
  7.      AUTHOR:       Geraldine Kuo
  8.  
  9.  
  10.      OVERVIEW
  11.      ========
  12.      Source file for implementation of bltestDlg (TDialog).      
  13. */
  14.  
  15. #include <owl\owlpch.h>
  16.  
  17. #pragma hdrstop
  18. #include <ver.h>
  19.  
  20. #include "bltstapp.h"
  21. #include "bltstdlg.h"
  22.  
  23.  
  24.  
  25. DEFINE_RESPONSE_TABLE1(bltestDlg, TDialog)
  26.   EV_COMMAND(IDC_FIRST, HandleFirst),
  27.   EV_COMMAND(IDC_PREV, HandlePrev),
  28.   EV_COMMAND(IDC_NEXT, HandleNext),
  29.   EV_COMMAND(IDC_LAST, HandleLast),
  30.   EV_COMMAND(IDC_CONNECT, HandleConnect),
  31. END_RESPONSE_TABLE;
  32.  
  33. //////////////////////////////////////////////////////////
  34. // bltestAboutDlg
  35. // ==========
  36. // Construction/Destruction handling.
  37. bltestDlg::bltestDlg (TWindow *parent, TResId resId, TModule *module)
  38.      : TDialog(parent, resId, module)
  39. {
  40.      // INSERT>> Your constructor code here.
  41.      m_e1 = new OBoundEdit(this, IDC_EMPNO);
  42.      m_e2 = new OBoundEdit(this, IDC_JOB);
  43.      m_s1 = new OBoundStatic(this, IDC_ENAME);   
  44.      m_c1 = new OBoundCheckBox(this, IDC_B1);
  45.      m_c2 = new OBoundCheckBox(this, IDC_B2);
  46.      m_r1 = new OBoundRadioButton(this, IDC_RADIO1);
  47.      m_r2 = new OBoundRadioButton(this, IDC_RADIO2);
  48.      m_r3 = new OBoundRadioButton(this, IDC_RADIO3);
  49.      m_r4 = new OBoundRadioButton(this, IDC_RADIO4);
  50.      m_r5 = new OBoundRadioButton(this, IDC_RADIO5);
  51.  
  52.      m_gauge = new OBoundGauge(this, "", IDC_GAUGE, 200, 450, 340, 20);
  53.      m_slider = new OBoundHSlider(this, IDC_SLIDER, 200, 400, 340, 40);
  54. }
  55.  
  56. bltestDlg::~bltestDlg ()
  57. {
  58.      Destroy();
  59.      // INSERT>> Your destructor code here.
  60. }
  61.  
  62.  
  63. void bltestDlg::SetupWindow ()
  64. {
  65.      TDialog::SetupWindow();
  66. }    
  67.  
  68. void bltestDlg::HandleConnect()
  69. {
  70.      char con[256], db[256];
  71.      GetDlgItemText(IDC_CONSTRING, con, 256);
  72.      GetDlgItemText(IDC_DATABASE, db, 256);
  73.      
  74.      // open a database object
  75.      m_database.Open(db, con, 0);   
  76.  
  77.      // open a dynaset
  78.      m_binder.Open(m_database, "select * from emp2");
  79.  
  80.      m_s1->BindToBinder(&m_binder, "ename");        
  81.     
  82.      m_e1->BindToBinder(&m_binder, "empno");
  83.      m_e1->SetProperty(OBOUND_READONLY);
  84.      m_e2->BindToBinder(&m_binder, "job");
  85.      
  86.      m_c1->BindToBinder(&m_binder, "vacation");
  87.      m_c1->SetProperty((OValue)1, (OValue)0, OBOUND_READWRITE);
  88.      m_c2->BindToBinder(&m_binder, "vacation");
  89.      m_c2->SetProperty((OValue)1, (OValue)0, OBOUND_READONLY);
  90.      
  91.      m_r1->BindToBinder(&m_binder, "hobby");
  92.      m_r1->SetProperty((OValue)"Bowling");
  93.      m_r2->BindToBinder(&m_binder, "hobby");
  94.      m_r2->SetProperty((OValue)"Fishing");
  95.      m_r3->BindToBinder(&m_binder, "hobby");
  96.      m_r3->SetProperty((OValue)"Shopping");
  97.      m_r4->BindToBinder(&m_binder, "hobby");
  98.      m_r4->SetProperty((OValue)"Swimming");
  99.      m_r5->BindToBinder(&m_binder, "hobby");
  100.      m_r5->SetProperty((OValue)"Windsurfing");
  101.  
  102.      m_gauge->BindToBinder(&m_binder, "comm");
  103.      m_gauge->SetProperty((OValue)0, (OValue)3000);
  104.  
  105.      m_slider->BindToBinder(&m_binder, "sal");
  106.      m_slider->SetProperty((OValue)100, (OValue)7000);
  107.      
  108.      m_binder.MoveFirst();
  109.  
  110.      ::EnableWindow(GetDlgItem(IDC_FIRST), TRUE);
  111.      ::EnableWindow(GetDlgItem(IDC_PREV), TRUE);
  112.      ::EnableWindow(GetDlgItem(IDC_NEXT), TRUE);
  113.      ::EnableWindow(GetDlgItem(IDC_LAST), TRUE);
  114. }
  115.  
  116. void bltestDlg::HandleFirst()
  117. {
  118.     m_binder.MoveFirst();
  119. }
  120.  
  121. void bltestDlg::HandlePrev()
  122. {
  123.     m_binder.MovePrev();
  124. }
  125.  
  126. void bltestDlg::HandleNext()
  127. {
  128.     m_binder.MoveNext();
  129. }
  130.  
  131. void bltestDlg::HandleLast()
  132. {
  133.     m_binder.MoveLast();
  134. }
  135.