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

  1. // VirtualDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "VCDemo.h"
  6. #include "VirtualDlg.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. // CVirtualDlg dialog
  16.  
  17.  
  18. CVirtualDlg::CVirtualDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CVirtualDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CVirtualDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void CVirtualDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CVirtualDlg)
  31.     DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
  32.     //}}AFX_DATA_MAP
  33. }
  34.  
  35.  
  36. BEGIN_MESSAGE_MAP(CVirtualDlg, CDialog)
  37.     //{{AFX_MSG_MAP(CVirtualDlg)
  38.     //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CVirtualDlg message handlers
  43.  
  44. BEGIN_EVENTSINK_MAP(CVirtualDlg, CDialog)
  45.     //{{AFX_EVENTSINK_MAP(CVirtualDlg)
  46.     ON_EVENT(CVirtualDlg, IDC_SGCTRL1, 30 /* OnGetCellData */, OnOnGetCellDataSgctrl1, VTS_I4 VTS_I4 VTS_PVARIANT VTS_PBOOL)
  47.     //}}AFX_EVENTSINK_MAP
  48. END_EVENTSINK_MAP()
  49.  
  50. BOOL CVirtualDlg::OnInitDialog() 
  51. {
  52.     CDialog::OnInitDialog();
  53.     
  54.     // TODO: Add extra initialization here
  55.     m_ctrl.DoSetEqualRowHeight(TRUE);    
  56.     m_ctrl.SetRows( 16384 );
  57.     m_ctrl.SetCols( 256 );
  58.     m_ctrl.SetGridReadOnly( TRUE );
  59.     m_ctrl.SetSideLabelWidth( 100 );
  60.     m_ctrl.SetEnablePopMenu(FALSE);
  61.  
  62.     m_ctrl.SetPageLabelVisible( FALSE );
  63.     m_ctrl.DoSetCanDragDrop(FALSE);
  64.     COleVariant var( "VCDEMO" );
  65.     m_ctrl.DoSetMessageTitle( var );
  66.  
  67.     return TRUE;  // return TRUE unless you set the focus to a control
  68.                   // EXCEPTION: OCX Property Pages should return FALSE
  69. }
  70.  
  71. void CVirtualDlg::OnOnGetCellDataSgctrl1(long col, long row, VARIANT FAR* data, BOOL FAR* changed) 
  72. {
  73.     // TODO: Add your control notification handler code here
  74.     if( col < 0 || row < 0 )return;
  75.  
  76.     *changed = TRUE;
  77.     COleVariant tmp = long(col+1+(row+1)*10000);
  78.  
  79.     *data = tmp.Detach();
  80. }
  81.