home *** CD-ROM | disk | FTP | other *** search
- // InputDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "VCDemo.h"
- #include "InputDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CInputDlg dialog
-
-
- CInputDlg::CInputDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CInputDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CInputDlg)
- m_dynamic = TRUE;
- //}}AFX_DATA_INIT
- }
-
-
- void CInputDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CInputDlg)
- DDX_Check(pDX, IDC_CHECK1, m_dynamic);
- DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CInputDlg, CDialog)
- //{{AFX_MSG_MAP(CInputDlg)
- ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CInputDlg message handlers
-
- BOOL CInputDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_ctrl.DoSetCellString( 0,1, "Upper case in B2");
- m_ctrl.DoSetCellInputControlCase( 1,1, 1 );
-
- m_ctrl.DoSetCellString( 0,3, "date format in B4");
- m_ctrl.DoSetCellInputControlMask( 1,3, "99-99-9999" );
-
- m_ctrl.DoSetCellString( 0,5, "value range(50.0 -- 80.0)in B6");
- m_ctrl.DoSetCellInputOnlyValue( 1,5, TRUE, 80.0, TRUE, 50.0 );
-
- m_ctrl.DoSetCellString( 0,7, "Input not allowed in B8");
- m_ctrl.DoSetCellReadOnly( 1,9, TRUE ); //same effect with B8
- //use event to control this
-
- m_ctrl.DoSetColWidth( 0, 300 );
- m_ctrl.DoSetColWidth( 1, 160 );
- m_ctrl.SetPageLabelVisible( FALSE );
- COleVariant var( "VCDEMO" );
- m_ctrl.DoSetMessageTitle( var );
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- void CInputDlg::OnCheck1()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- m_ctrl.SetDynamicEditArea(m_dynamic);
- }
-
- BEGIN_EVENTSINK_MAP(CInputDlg, CDialog)
- //{{AFX_EVENTSINK_MAP(CInputDlg)
- ON_EVENT(CInputDlg, IDC_SGCTRL1, 31 /* OnAllowEditCellVBS */, OnOnAllowEditCellVBSSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT)
- ON_EVENT(CInputDlg, IDC_SGCTRL1, 48 /* OnAllowDeleteCell */, OnOnAllowDeleteCellSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT)
- ON_EVENT(CInputDlg, IDC_SGCTRL1, 49 /* OnSetCellData */, OnOnSetCellDataSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT VTS_PVARIANT)
- //}}AFX_EVENTSINK_MAP
- END_EVENTSINK_MAP()
-
-
- void CInputDlg::OnOnAllowEditCellVBSSgctrl1(long col, long row, VARIANT FAR* allow)
- {
- // TODO: Add your control notification handler code here
- COleVariant var( allow );
-
- if( col == 1 && row == 7 )var = 0l;
- else var = 1l;
-
- *allow = var.Detach();
- }
-
- void CInputDlg::OnOnAllowDeleteCellSgctrl1(long col, long row, VARIANT FAR* allow)
- {
- // TODO: Add your control notification handler code here
- COleVariant var( allow );
- var = 0l;
- *allow = var.Detach();
- }
-
- void CInputDlg::OnOnSetCellDataSgctrl1(long col, long row, VARIANT FAR* data, VARIANT FAR* changed)
- {
- // TODO: Add your control notification handler code here
- if( col == 0 && row == 0 ){
- COleVariant data2( data ), changed2( changed );
- changed2 = 1L;
- data2 = "Test";
- *changed = changed2.Detach();
- *data = data2.Detach();
- }
- }
-