192 lines
3.9 KiB
C++
192 lines
3.9 KiB
C++
// ZTestDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "sp.h"
|
|
#include "ZTestDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CZTestDlg dialog
|
|
|
|
|
|
CZTestDlg::CZTestDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CZTestDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CZTestDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CZTestDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CZTestDlg)
|
|
DDX_Control(pDX, IDC_REPORT, m_rc);
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CZTestDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CZTestDlg)
|
|
ON_BN_CLICKED(IDC_BTNREFORMAT, OnBtnreformat)
|
|
ON_BN_CLICKED(IDC_ACTIVATE, OnActivate)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CZTestDlg message handlers
|
|
|
|
BOOL CZTestDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
RVCOLUMN rvc;
|
|
|
|
rvc.nFormat = RVCF_TEXT;
|
|
rvc.lpszText = "Tech:";
|
|
rvc.iWidth = 75;
|
|
m_rc.DefineColumn(0, &rvc);
|
|
|
|
rvc.lpszText = "Date:";
|
|
rvc.iWidth = 75;
|
|
m_rc.DefineColumn(1, &rvc);
|
|
|
|
rvc.lpszText = "Start:";
|
|
rvc.iWidth = 75;
|
|
m_rc.DefineColumn(2, &rvc);
|
|
|
|
rvc.lpszText = "Stop:";
|
|
rvc.iWidth = 75;
|
|
m_rc.DefineColumn(3, &rvc);
|
|
|
|
rvc.lpszText = "Hours:";
|
|
rvc.iWidth = 75;
|
|
m_rc.DefineColumn(4, &rvc);
|
|
|
|
rvc.lpszText = "Rate:";
|
|
rvc.iWidth = 175;
|
|
m_rc.DefineColumn(5, &rvc);
|
|
|
|
//HIDDEN ID COLUMN
|
|
rvc.nFormat = RVCF_TEXT | RVCF_EX_FIXEDWIDTH;
|
|
rvc.lpszText = "ID";
|
|
rvc.iWidth = 0;
|
|
m_rc.DefineColumn(6, &rvc);
|
|
|
|
|
|
//but if there are no preferences then you would need it
|
|
m_rc.ActivateColumn(0, 0);
|
|
m_rc.ActivateColumn(1, 1);
|
|
m_rc.ActivateColumn(2, 2);
|
|
m_rc.ActivateColumn(3, 3);
|
|
m_rc.ActivateColumn(4, 4);
|
|
m_rc.ActivateColumn(5, 5);
|
|
m_rc.ActivateColumn(6, 6);
|
|
|
|
m_rc.InsertColor(0, 0x00C0D8C0);
|
|
m_rc.InsertColor(1, 0x00D0C0C0);
|
|
m_rc.InsertColor(2, 0x00804000);
|
|
|
|
m_rc.ModifyStyle(0, RVS_SINGLESELECT);
|
|
//m_rc.ModifyStyle(0, RVS_SHOWCOLORALTERNATE);
|
|
|
|
|
|
//turn off the grids
|
|
m_rc.ModifyStyle(RVS_SHOWVGRID, 0);
|
|
m_rc.ModifyStyle(RVS_SHOWHGRID, 0);
|
|
|
|
|
|
|
|
m_rc.SetItemCount(100);
|
|
|
|
|
|
|
|
|
|
|
|
CString tech="Tech:Asfe";
|
|
CString date="blahdate";
|
|
CString stop="Stop";
|
|
|
|
//Set the look of the row and insert it
|
|
//TECH
|
|
RVITEM rvi;
|
|
rvi.iItem = 0;
|
|
rvi.iSubItem = 0;
|
|
rvi.nMask = RVIM_PREVIEW|RVIM_TEXT|RVIM_LPARAM;
|
|
rvi.nPreview = 0;
|
|
rvi.lParam = 0;
|
|
rvi.lpszText = tech.GetBuffer(tech.GetLength());
|
|
m_rc.InsertItem(&rvi);
|
|
|
|
|
|
//DATE
|
|
rvi.iSubItem = 1;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = date.GetBuffer(date.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
CString start;
|
|
start="start";
|
|
//START
|
|
rvi.iSubItem = 2;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = start.GetBuffer(start.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
//STOP
|
|
rvi.iSubItem = 3;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = stop.GetBuffer(stop.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
CString hours="HOURS";
|
|
//HOURS
|
|
rvi.iSubItem = 4;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = hours.GetBuffer(hours.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
CString rate="RAte";
|
|
//RATE
|
|
rvi.iSubItem = 5;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = rate.GetBuffer(rate.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
CString index="index";
|
|
//ID
|
|
rvi.iSubItem = 6;
|
|
rvi.nMask = RVIM_TEXT;
|
|
rvi.lpszText = index.GetBuffer(index.GetLength());
|
|
m_rc.SetItem(&rvi);
|
|
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CZTestDlg::OnBtnreformat()
|
|
{
|
|
|
|
m_rc.DeactivateColumn(1);
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
void CZTestDlg::OnActivate()
|
|
{
|
|
|
|
m_rc.ActivateColumn(1);
|
|
return;
|
|
}
|