home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / Cell Control / DATA1.CAB / VCDEMO_Files / InputDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-11  |  3.3 KB  |  119 lines

  1. // InputDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "VCDemo.h"
  6. #include "InputDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CInputDlg dialog
  16.  
  17.  
  18. CInputDlg::CInputDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CInputDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CInputDlg)
  22.     m_dynamic = TRUE;
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void CInputDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CInputDlg)
  31.     DDX_Check(pDX, IDC_CHECK1, m_dynamic);
  32.     DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
  33.     //}}AFX_DATA_MAP
  34. }
  35.  
  36.  
  37. BEGIN_MESSAGE_MAP(CInputDlg, CDialog)
  38.     //{{AFX_MSG_MAP(CInputDlg)
  39.     ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CInputDlg message handlers
  45.  
  46. BOOL CInputDlg::OnInitDialog() 
  47. {
  48.     CDialog::OnInitDialog();
  49.     
  50.     // TODO: Add extra initialization here
  51.     m_ctrl.DoSetCellString( 0,1, "Upper case in B2");
  52.     m_ctrl.DoSetCellInputControlCase( 1,1, 1 );
  53.  
  54.     m_ctrl.DoSetCellString( 0,3, "date format in B4");
  55.     m_ctrl.DoSetCellInputControlMask( 1,3, "99-99-9999" );
  56.  
  57.     m_ctrl.DoSetCellString( 0,5, "value range(50.0 -- 80.0)in B6");
  58.     m_ctrl.DoSetCellInputOnlyValue( 1,5, TRUE, 80.0, TRUE, 50.0 );
  59.  
  60.     m_ctrl.DoSetCellString( 0,7, "Input not allowed in B8");
  61.     m_ctrl.DoSetCellReadOnly( 1,9, TRUE );            //same effect with B8
  62.     //use event to control this 
  63.  
  64.     m_ctrl.DoSetColWidth( 0, 300 );
  65.     m_ctrl.DoSetColWidth( 1, 160 );
  66.     m_ctrl.SetPageLabelVisible( FALSE );
  67.     COleVariant var( "VCDEMO" );
  68.     m_ctrl.DoSetMessageTitle( var );
  69.     return TRUE;  // return TRUE unless you set the focus to a control
  70.                   // EXCEPTION: OCX Property Pages should return FALSE
  71. }
  72.  
  73. void CInputDlg::OnCheck1() 
  74. {
  75.     // TODO: Add your control notification handler code here
  76.     UpdateData();
  77.     m_ctrl.SetDynamicEditArea(m_dynamic);
  78. }
  79.  
  80. BEGIN_EVENTSINK_MAP(CInputDlg, CDialog)
  81.     //{{AFX_EVENTSINK_MAP(CInputDlg)
  82.     ON_EVENT(CInputDlg, IDC_SGCTRL1, 31 /* OnAllowEditCellVBS */, OnOnAllowEditCellVBSSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT)
  83.     ON_EVENT(CInputDlg, IDC_SGCTRL1, 48 /* OnAllowDeleteCell */, OnOnAllowDeleteCellSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT)
  84.     ON_EVENT(CInputDlg, IDC_SGCTRL1, 49 /* OnSetCellData */, OnOnSetCellDataSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT VTS_PVARIANT)
  85.     //}}AFX_EVENTSINK_MAP
  86. END_EVENTSINK_MAP()
  87.  
  88.  
  89. void CInputDlg::OnOnAllowEditCellVBSSgctrl1(long col, long row, VARIANT FAR* allow) 
  90. {
  91.     // TODO: Add your control notification handler code here
  92.     COleVariant var( allow );
  93.  
  94.     if( col == 1 && row == 7 )var = 0l;    
  95.     else var = 1l;
  96.  
  97.     *allow = var.Detach();
  98. }
  99.  
  100. void CInputDlg::OnOnAllowDeleteCellSgctrl1(long col, long row, VARIANT FAR* allow) 
  101. {
  102.     // TODO: Add your control notification handler code here
  103.     COleVariant var( allow );
  104.     var = 0l;    
  105.     *allow = var.Detach();
  106. }
  107.  
  108. void CInputDlg::OnOnSetCellDataSgctrl1(long col, long row, VARIANT FAR* data, VARIANT FAR* changed) 
  109. {
  110.     // TODO: Add your control notification handler code here
  111.     if( col == 0 && row == 0 ){
  112.         COleVariant data2( data ), changed2( changed );
  113.         changed2 = 1L;
  114.         data2 = "Test";
  115.         *changed = changed2.Detach();
  116.         *data = data2.Detach();
  117.     }
  118. }
  119.