Beispiel #1
0
static void initList(CGridListCtrlGroups& listCtrl,const CListCtrl_DataModel& dataModal)
{
	listCtrl.SetCellMargin(1.2);

	CGridRowTraitXP* pRowTrait = new CGridRowTraitXP;
	listCtrl.SetDefaultRowTrait(pRowTrait);
	listCtrl.EnableVisualStyles(true);

	// Create Columns
	listCtrl.InsertHiddenLabelColumn();	// Requires one never uses column 0

	for(int col = 0; col < dataModal.GetColCount() ; ++col)
	{
		const CString& title = dataModal.GetColTitle(col);
		CGridColumnTrait* pTrait = NULL;
		if (col==1)
		{
			CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
			pComboTrait->AddItem((DWORD_PTR)0,_T("是"));
			pComboTrait->AddItem((DWORD_PTR)1,_T("否"));
			pTrait = pComboTrait;
		}
		else if (col==2)
		{
			CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
			pComboTrait->AddItem((DWORD_PTR)0,_T("正在维修"));
			pComboTrait->AddItem((DWORD_PTR)1,_T("已经撤出"));
			pComboTrait->AddItem((DWORD_PTR)2,_T("正在建设"));
			pTrait = pComboTrait;
		}

		else
		{
			pTrait = new CGridColumnTraitEdit;
		}
		listCtrl.InsertColumnTrait(col+1, title, LVCFMT_LEFT, 100, col, pTrait);
	}


	CViewConfigSectionWinApp* pColumnProfile = new CViewConfigSectionWinApp(_T("Sample List"));
	pColumnProfile->AddProfile(_T("默认"));
	pColumnProfile->AddProfile(_T("自定义"));
	//pColumnProfile->DeleteProfile(_T("Special"));
	listCtrl.SetupColumnConfig(pColumnProfile);
}
Beispiel #2
0
BOOL CDialog_Add_Ath::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化	
	//list_Ath.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	list_Ath.SetCellMargin(1.2);
	CGridRowTraitXP* pRowTrait = new CGridRowTraitXP;
	list_Ath.SetDefaultRowTrait(pRowTrait);

	// Create Columns
	list_Ath.InsertHiddenLabelColumn();	// Requires one never uses column 0
	list_Ath.InsertColumnTrait(1, _T("姓名"), LVCFMT_CENTER, 100, -1, new CGridColumnTraitEdit);
	CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
	pComboTrait->AddItem((DWORD_PTR)0, _T("男"));
	pComboTrait->AddItem((DWORD_PTR)0, _T("女"));
	list_Ath.InsertColumnTrait(2, _T("性别"), LVCFMT_CENTER, 100, -1, pComboTrait);
	CGridColumnTraitDateTime* pDateTimeTrait = new CGridColumnTraitDateTime;
	pDateTimeTrait->SetToggleSelection(true);
	list_Ath.InsertColumnTrait(3, _T("出生日期"), LVCFMT_CENTER, 100, -1, pDateTimeTrait);
	pComboTrait = new CGridColumnTraitCombo;
	AthleteManagerView* parent = (AthleteManagerView*)this->m_pParentWnd;
	vector<Organization>::iterator i_d;
	int index = 0;
	for(i_d = parent->allOrg.begin(); i_d != parent->allOrg.end(); ++i_d, ++index){
		pComboTrait->AddItem(i_d->ID, i_d->Name);
	}
	list_Ath.InsertColumnTrait(4, _T("单位"), LVCFMT_CENTER, 100, -1, pComboTrait);
	list_Ath.InsertColumnTrait(5, _T("备注"), LVCFMT_CENTER, 100, -1, new CGridColumnTraitEdit);	

	// Insert data into list-control by copying from datamodel
	list_Ath.InsertItem(0, _T(""));
	list_Ath.SetItemText(0, 1, NEWCOLTEXT);
	list_Ath.SetItemText(0, 2, _T("男"));
	list_Ath.SetItemText(0, 3, _T("1979/06/04"));
	list_Ath.SetItemText(0, 4, _T(""));
	list_Ath.SetItemText(0, 5, _T(""));

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Beispiel #3
0
void CDialog_Add_Ath::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	vector<Athlete> v_sames;
	int row = list_Ath.GetItemCount() - 1;
	while(row >= 0) {
		if(list_Ath.GetItemText(row, 1).Compare(NEWCOLTEXT) == 0){
			--row;
			continue;
		}
		Athlete ath;
		ath.Name = list_Ath.GetItemText(row, 1);
		ath.Sex = list_Ath.GetItemText(row, 2);
		ath.Birth = list_Ath.GetItemText(row, 3);
		ath.Org.Name = list_Ath.GetItemText(row, 4);
		CGridColumnTraitCombo* ccb = (CGridColumnTraitCombo*)list_Ath.GetCellColumnTrait(row, 4);
		ath.Org.ID = ccb->GetSelKey(ath.Org.Name);
		ath.Description = list_Ath.GetItemText(row, 5);

		if(ath.AddNew() == TRUE)
			list_Ath.DeleteItem(row);
		else
			v_sames.push_back(ath);
		--row;
	}

	if(v_sames.size() > 0){
		if(MessageBox(_T("列表中剩余的是已经存在同名且同队的运动员,\n是否仍然添加?"),
			_T("是否继续"), MB_YESNO|MB_ICONQUESTION) == IDNO)
			return;
		vector<Athlete>::iterator i_s;
		for(i_s = v_sames.begin(); i_s != v_sames.end(); ++i_s)
			i_s->AddNew(FALSE);
	}
	CDialogEx::OnOK();
}
void WZDlgDownload::_DrawRunTypeList()
{
	listRunTypeCtrl_.DeleteAllItems();
	listRunTypeCtrl_.DeleteColumn(2);
	
	//添加组合框的所有运行方式
	CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
	pComboTrait->SetStyle( pComboTrait->GetStyle() | CBS_DROPDOWNLIST);
	pComboTrait->AddItem(0, i8desk::data_helper::RT_UNKNOWN.c_str());
	pComboTrait->AddItem(1, i8desk::data_helper::RT_LOCAL.c_str());
	pComboTrait->AddItem(2, i8desk::data_helper::RT_DIRECT.c_str());

	int loop = 3;
	i8desk::business::VDisk::RunTypeDesc(std::tr1::bind(&CGridColumnTraitCombo::AddItem, pComboTrait, 
		loop++, std::tr1::placeholders::_1));

	listRunTypeCtrl_.InsertColumnTrait(2, _T("运行方式"), LVCFMT_LEFT, 220, 2, pComboTrait);
}
Beispiel #5
0
/////////////////////////////////////////////////////////////////////////////
// CSetTimeDlg message handlers
BOOL CSetTimeDlg::OnInitDialog()
{
  CXTResizeDialog::OnInitDialog();

	CMainFrame* pFWnd=(CMainFrame*)AfxGetMainWnd();
   	pFWnd->m_pSetTimeDlg=this;

	SetResize(IDOK_SEND,                  SZ_BOTTOM_LEFT,   SZ_BOTTOM_LEFT);
	SetResize(IDCANCEL,              SZ_BOTTOM_LEFT,   SZ_BOTTOM_LEFT);
	if(chcommand == 0x43)       //配置测点 
	{
    	SetResize(IDC_LIST_C,         SZ_TOP_LEFT,    SZ_BOTTOM_CENTER);
    	SetResize(IDC_LIST_C2,         SZ_TOP_CENTER,    SZ_BOTTOM_RIGHT);
	}
	else
    	SetResize(IDC_LIST_C,         SZ_TOP_LEFT,    SZ_BOTTOM_RIGHT);

	// Enable Office XP themes.
	XTThemeManager()->SetTheme(xtThemeOffice2003);



	HWND hWndHeader = m_listC.GetDlgItem(0)->GetSafeHwnd();
	m_header.SubclassWindow(hWndHeader);

	// add bitmap images.
	m_header.SetBitmap(0, IDB_COLUMN_0, FALSE, RGB(0,255,0));
	m_header.SetBitmap(1, IDB_COLUMN_1, FALSE, RGB(0,255,0));
	//m_header.SetBitmap(2, IDB_COLUMN_2, FALSE, RGB(0,255,0));

	// enable auto sizing.
	m_header.EnableAutoSize(TRUE);
	m_header.ResizeColumnsToFit();
	//SortColumn(m_nSortedCol, m_bAscending);

//	m_listCtrl.ModifyExtendedStyle(0, LVS_EX_FULLROWSELECT|LVS_EX_FULLROWSELECT);
	m_listC.ModifyExtendedStyle(0, LVS_EX_GRIDLINES);
	m_listC2.ModifyExtendedStyle(0, LVS_EX_GRIDLINES);

	// insert strings into the size combo box.
	if(chcommand == 0x5A)        //故障闭锁
	{
    	m_FUNCTION.AddString("关闭");
    	m_FUNCTION.AddString("使能");
	}
	else
	{
    	m_FUNCTION.AddString("吸合");
    	m_FUNCTION.AddString("断开");
	}

	for(int i = 01; i < MAX_FDS; i++)
	{
		CString strItem;
		strItem.Format(_T("%d"), i);
    	m_VERIFYT.AddString(strItem);
		if(i<9)
        	m_PORT.AddString(strItem);
	}
	m_VERIFYT.SetCurSel(0);
	m_PORT.SetCurSel(0);
	m_FUNCTION.SetCurSel(0);

    CString szConnect ;

	if(chcommand == 0x54)         //校时
	{
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_STATICV2)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_FUNCTION)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_BUT_RES)->ShowWindow(SW_HIDE);;
		m_listC.InsertColumn(0,"命令返回信息",LVCFMT_LEFT,450);
    	GetDlgItem(IDC_STATICV)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_VERIFYT)->ShowWindow(SW_HIDE);;
	}
	else if(chcommand == 0x4B)   //手动控制
	{
		m_listC.DeleteAllItems();
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);;
		SetWindowText("手动控制操作");

		m_listC.InsertColumn(0,"命令返回信息",LVCFMT_LEFT,450);
//		m_listC.InsertColumn(1,"控制量",LVCFMT_LEFT,80);
//		m_listC.InsertColumn(2,"关联量",LVCFMT_LEFT,80);

/*		int xxx = 0;
		int yyy = 0;
		unsigned char nfds = m_VERIFYT.GetCurSel()+1;
    	for( int iItem = 0; iItem < 8 ; iItem++)
		{
			yyy = xxx;
        	for( int i = 0; i < 64 ; i++)
			{
		      	if(m_ADCbreakE[nfds][iItem+17][i].bFSd != 0)
				{
				  m_listC.InsertItem(i+yyy, m_SlaveStation[nfds][iItem+17].WatchName);
				  m_listC.SetItemText(i+yyy, 1, m_ADCbreakE[nfds][iItem+17][i].cpoint);
				  m_listC.SetItemText(i+yyy, 2, m_ADCbreakE[nfds][iItem+17][i].adpoint);
				  xxx++;
				}
			}
		}
		m_nSecond = xxx;*/
	}
	else if(chcommand == 0x43)       //配置测点 
	{
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_STATICV2)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_FUNCTION)->ShowWindow(SW_HIDE);;
		SetWindowText("分站测点配置操作");
    	GetDlgItem(IDC_BUT_RES)->SetWindowText("初始化");
		m_listC.InsertColumn(0,"命令返回信息",LVCFMT_LEFT,450);
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
	}
	else if(chcommand == 0x41)        //配置分站
	{
		m_SControl.Create();
		m_SControl.CursorType(adOpenDynamic);
		m_SControl.CacheSize(50);
		m_SControl._SetRecordsetEvents(new CAccountSetEvents);
		m_SControl.Open(_T("Select * From specialcontrol"), &theApp.m_Cn);
		m_SControl.MarshalOptions(adMarshalModifiedOnly);

    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
		SetWindowText("配置分站操作");
    	GetDlgItem(IDC_STATICV2)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_COMBO_FUNCTION)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_VERIFYT)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_STATICV)->ShowWindow(SW_HIDE);;
//    	GetDlgItem(IDC_STATICV1)->SetWindowText("串口号");
    	GetDlgItem(IDC_BUT_RES)->ShowWindow(SW_HIDE);;

    	m_listC.InsertHiddenLabelColumn();	// Requires one never uses column 0
    	for(int col = 0; col < 2 ; ++col)
		{
		CString title;  int kkk;
		CGridColumnTrait* pTrait = NULL;
		if (col==0)	// Country
		{
			kkk = 270;
			title ="分站号";
		}
		if (col==1)	// Year won
		{
			kkk = 90;
			title ="串口号";
			CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
			pComboTrait->AddItem(0, "无配置");
         	for(int i = 01; i < 100; i++)
			{
         		CString strItem,strtemp;
          		strItem.Format(_T("%d"), i);
              	pComboTrait->AddItem(i, strItem);
			}
			pTrait = pComboTrait;
		}
		m_listC.InsertColumnTrait(col+1, title, LVCFMT_LEFT, kkk, col, pTrait);
		}
		int iItem = 0;
		m_SControl.MoveFirst();
		while ( !m_SControl.IsEOF() )
		{
				  m_listC.InsertItem(iItem, "通断");
				  CString dddd;
				  dddd.Format("%d",m_SControl.m_szSID);
				  m_listC.SetItemText(iItem, 1, dddd);
				  dddd.Format("%d",m_SControl.m_szSerialnum);
				  m_listC.SetItemText(iItem, 2, dddd);
				  iItem++;
			m_SControl.MoveNext();
		}
	}
	else if(chcommand == 0x47)        //通讯测试
	{
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);;
		SetWindowText("通讯测试");
    	GetDlgItem(IDC_STATICV2)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_FUNCTION)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);;
    	GetDlgItem(IDC_BUT_RES)->ShowWindow(SW_HIDE);;
		m_listC.InsertColumn(0,"命令返回信息",LVCFMT_LEFT,450);
	}
	else if(chcommand == 0x5A)        //故障闭锁
	{
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
		SetWindowText("故障闭锁配置");
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_STATICV2)->SetWindowText("故障闭锁状态");
    	GetDlgItem(IDC_BUT_RES)->SetWindowText("初始化");

		m_SControl.Create();
		m_SControl.CursorType(adOpenDynamic);
		m_SControl.CacheSize(50);
		m_SControl._SetRecordsetEvents(new CAccountSetEvents);
		m_SControl.Open(_T("Select * From specialcontrol"), &theApp.m_Cn);
		m_SControl.MarshalOptions(adMarshalModifiedOnly);

		m_listC.InsertColumn(0,"分站号",LVCFMT_LEFT,300);
		m_listC.InsertColumn(1,"故障闭锁状态",LVCFMT_LEFT,120);
		int iItem = 0;
		m_SControl.MoveFirst();
		while ( !m_SControl.IsEOF() )
		{
				  CString dddd;
				  dddd.Format("%d",m_SControl.m_szSID);
				  m_listC.InsertItem(iItem, dddd);
				  if(m_SControl.m_szSpeCtrol)
    				  m_listC.SetItemText(iItem, 1, "使能");
				  else
    				  m_listC.SetItemText(iItem, 1, "关闭");
				  iItem++;
			m_SControl.MoveNext();
		}
		m_nSecond = 64;
	}
	else if(chcommand == 0x46)        //风电瓦斯闭锁
	{
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
		SetWindowText("风电瓦斯闭锁配置");
    	GetDlgItem(IDC_STATICV1)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_COMBO_PORT)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_STATICV2)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_COMBO_FUNCTION)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_BUT_RES)->SetWindowText("初始化");
		InitWGas(0);
	}
	else if(chcommand == 0xf0)        //双风门、主扇备扇报警
	{
		m_Records1.clear();
		m_Records2.clear();
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
		SetWindowText("双设备报警逻辑管理");
    	GetDlgItem(IDOK_SEND)->SetWindowText("添加");
    	GetDlgItem(IDC_BUT_RES)->SetWindowText("删除");
    	GetDlgItem(IDC_STATICV1)->SetWindowText("开关量1");
    	GetDlgItem(IDC_STATICV2)->SetWindowText("开关量2");
    	GetDlgItem(IDC_STATICV)->SetWindowText(_T("报警态"));
//    	GetDlgItem(IDC_COMBO_VERIFYT)->ShowWindow(SW_HIDE);
	 	    m_PORT.ResetContent();
	 	    m_FUNCTION.ResetContent();
			m_VERIFYT.ResetContent();
			m_VERIFYT.AddString(_T("0态"));
			m_VERIFYT.AddString(_T("1态"));
          	m_VERIFYT.SetCurSel(0);

		m_Fans.Create();
		m_Fans.CursorType(adOpenDynamic);
		m_Fans.CacheSize(50);
		m_Fans._SetRecordsetEvents(new CAccountSetEvents);
		m_Fans.Open(_T("Select * From fanscon"), &theApp.m_Cn);
		m_Fans.MarshalOptions(adMarshalModifiedOnly);

    	int ptype;	CString dddd;
		for(int i = 1; i < MAX_FDS;i++ )
		{
			for(int j = 0; j < MAX_CHAN;j++ )
			{
       			ptype = m_SlaveStation[i][j].ptype;
       			if((ptype == 10 || ptype == 13 ||ptype == 14) && m_SlaveStation[i][j].WatchName !="")
				{
    				dddd = m_SlaveStation[i][j].strPN + "|"+m_SlaveStation[i][j].WatchName;
	        	    m_PORT.AddString(dddd);
	        	    m_FUNCTION.AddString(dddd);
				}
			}
		}
	     	    m_PORT.SetCurSel(0);
	    	    m_FUNCTION.SetCurSel(0);
		m_listC.InsertColumn(0,"开关量1",LVCFMT_LEFT,60);
		m_listC.InsertColumn(1,"安装地点/名称1",LVCFMT_LEFT,200);
		m_listC.InsertColumn(2,"开关量2",LVCFMT_LEFT,60);
		m_listC.InsertColumn(3,"安装地点/名称2",LVCFMT_LEFT,200);
		m_listC.InsertColumn(4,"报警状态",LVCFMT_LEFT,60);
//		m_listC.InsertColumn(5,"ID",LVCFMT_LEFT,30);
		int iItem = 0;
		m_Fans.MoveFirst();
		while ( !m_Fans.IsEOF() )
		{
				  CString dddd = m_Fans.m_szpointnum1;
    		dddd.TrimRight();
				  m_listC.InsertItem(iItem, dddd);
				  m_Records1.push_back(dddd);
				  dddd = m_Fans.m_szName1;
    		dddd.TrimRight();
    			  m_listC.SetItemText(iItem, 1, dddd);
				  dddd = m_Fans.m_szpointnum2;
    		dddd.TrimRight();
    			  m_listC.SetItemText(iItem, 2, dddd);
				  m_Records2.push_back(dddd);
				  dddd = m_Fans.m_szName2;
    		dddd.TrimRight();
    			  m_listC.SetItemText(iItem, 3, dddd);
            dddd.Format(_T("%d态"), m_Fans.m_szAStatus);
    			  m_listC.SetItemText(iItem, 4, dddd);
 			m_nSecond = m_Fans.m_szFansID+1;
//            dddd.Format(_T("%d"), m_nSecond-1);
//    			  m_listC.SetItemText(iItem, 5, dddd);
			iItem++;
			m_Fans.MoveNext();
		}
	}
	else if(chcommand == 0xf1)            //数据显示页属性
	{
		m_Records1.clear();
    	GetDlgItem(IDC_LIST_C2)->ShowWindow(SW_HIDE);
		SetWindowText("数据显示页属性");
    	GetDlgItem(IDOK_SEND)->SetWindowText("保存");
    	GetDlgItem(IDC_BUT_RES)->ShowWindow(SW_HIDE);
    	GetDlgItem(IDC_STATICV1)->SetWindowText("文件名");
    	GetDlgItem(IDC_STATICV2)->SetWindowText("列表");
    	GetDlgItem(IDC_STATICV)->SetWindowText(_T("存表"));
    	GetDlgItem(IDC_COMBO_VERIFYT)->EnableWindow(FALSE);

		CString strPointNo,cccc,strrsy,strrsy1;
    	strrsy = gstrTimeOut + "\\" + strMetrics+ "rsy\\";
	 	    m_PORT.ResetContent();
	 	    m_FUNCTION.ResetContent();
			m_VERIFYT.ResetContent();

        for(int i =0; i < theApp.m_addfilesy.size() ;i++)
		{
    		strPointNo = theApp.m_addfilesy[i];
       		int m_ishave = strPointNo.GetLength();
    		cccc = strPointNo.Mid(m_ishave-3,3);
    		strPointNo.Replace(strrsy,"");
    		if(cccc =="rsf")
			{
				m_Records1.push_back(strPointNo);
    			m_PORT.AddString(strPointNo);
			}
		}
//          	m_VERIFYT.SetCurSel(0);
        for(int k =1; k < 4 ;k++)
		{
	    		cccc.Format("%d",k);
    	 	    m_FUNCTION.AddString(cccc);
            	m_FUNCTION.SetCurSel(0);
		}

	// Give better margin to editors
     	m_listC.SetCellMargin(1.2);
    	CGridRowTraitXP* pRowTrait = new CGridRowTraitXP;
    	m_listC.SetDefaultRowTrait(pRowTrait);
	// Create Columns
     	m_listC.InsertHiddenLabelColumn();	// Requires one never uses column 0
    	for(int col = 0; col < 2 ; ++col)
		{
    		CString title;  int kkk;
			CGridColumnTrait* pTrait = NULL;
      		if (col==0)	// Country
			{
		    	kkk = 350;
	    		title ="数据显示页属性";
			}
	    	if (col==1)	// City
			{
		    	kkk = 100;
	    		title ="参数(整数)";
      			pTrait = new CGridColumnTraitEdit;
			}
    		m_listC.InsertColumnTrait(col+1, title, LVCFMT_LEFT, kkk, col, pTrait);
		}
		CString strl[35];
//		strl[0] = "是否可见(1可见|0隐藏)";		strl[1] = "子类头控制(1或0)";
//		strl[2] = "列表左上顶点x坐标";
//		strl[3] = "列表宽度";		strl[4] = "列表高度";		strl[5] = "第一列名字";
//		strl[6] = "第一列宽度";		strl[7] = "第二列名字";		strl[8] = "第二列宽度";
//		strl[9] = "第三列名字";		strl[10] = "第三列宽度";		strl[11] = "行数";
		strl[0] = "是否可见(1可见|0隐藏)";		strl[1] = "子类头控制(1或0)";
		strl[2] = "列表左上顶点x坐标";
		strl[3] = "列表宽度";		strl[4] = "列表高度";		strl[5] = "第一列宽度";
		strl[6] = "第二列宽度";
		strl[7] = "第三列宽度";		//strl[8] = "行数";

		strl[8] = "最大值列宽度";		strl[9] = "最小值列宽度";		strl[10] = "平均值列宽度";
		strl[11] = "断电值列宽度";		strl[12] = "复电值列宽度";		strl[13] = "报警上限列宽度";
		strl[14] = "报警下限列宽度";		strl[15] = "量程高值列宽度";		strl[16] = "量程低值列宽度";
		strl[17] = "断电时刻列宽度";		strl[18] = "复电时刻列宽度";		strl[19] = "报警时刻列宽度";
		strl[20] = "馈电状态及时刻列宽度";		strl[21] = "断电范围列宽度";		strl[22] = "开停次数列宽度";	
		strl[23] = "工作时间列宽度";
		for( k =0; k < 22 ;k++)
		{
				  m_listC.InsertItem(k, "通断");
				  m_listC.SetItemText(k, 1, strl[k]);
				  m_listC.SetItemText(k, 2, "");
		}
	}

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #6
0
void CSetTimeDlg::InitWGas(int gasfds)
{
    if ( m_CommonSet._IsOpen() )
       m_CommonSet.Close();
		m_nSecond =  6;
		m_CommonSet.Create();
		m_CommonSet.CursorType(adOpenDynamic);
		m_CommonSet.CacheSize(50);
		m_CommonSet._SetRecordsetEvents(new CAccountSetEvents);
		m_CommonSet.Open(_T("Select * From commonset"), &theApp.m_Cn);
		m_CommonSet.MarshalOptions(adMarshalModifiedOnly);
		unsigned char nfds;
		if(gasfds == 0)
    		nfds= m_VERIFYT.GetCurSel()+1;
		else
    		nfds= gasfds;

		m_CommonSet.MoveFirst();
		while ( !m_CommonSet.IsEOF() )
		{
			int sfds = m_CommonSet.m_szCommonID;
			if(sfds >(nfds*6) && sfds <( (nfds+1)*6+1 ) )
			{
        		CString dddd = m_CommonSet.m_szstrc30;
				dddd.TrimRight();
				str_list[sfds-nfds*6-1].strl = dddd;
			}
			m_CommonSet.MoveNext();
		}

     	m_listC.DeleteAllItems();
	    for (int iItem1 = 2; iItem1 >= 0; iItem1--)
    		m_listC.DeleteColumn(iItem1);

    	m_listC.InsertHiddenLabelColumn();	// Requires one never uses column 0
    	for(int col = 0; col < 2 ; ++col)
		{
		CString title;  int kkk;
		CGridColumnTrait* pTrait = NULL;
		if (col==0)	// Country
		{
			kkk = 200;
			title ="传感器位置";
		}
		if (col==1)	// Year won
		{
			int k=0;
			kkk = 250;
			title ="通道号";
			CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;
         	for(int i = 01; i < MAX_CHAN; i++)
			{
         		CString strfds,strtemp,strchan;
				strtemp = m_SlaveStation[nfds][i].WatchName;
				if(strtemp != "")
				{
					int n=i;
					if(i>16)
						n = i-16;
                	strfds.Format(_T("%02d"), nfds);
                	strchan.Format(_T("%02d"), n);
					int n_ptype = m_SlaveStation[nfds][i].ptype;
					if(n_ptype < 3)
					{
                    	pComboTrait->AddItem(k, strfds+"A"+strchan+"|"+strtemp);
					    k++;
					}
					else if(n_ptype==10 || n_ptype==13 ||n_ptype==14)
					{
                    	pComboTrait->AddItem(k, strfds+"D"+strchan+"|"+strtemp);
					    k++;
					}
					else if(n_ptype == 12)
					{
                    	pComboTrait->AddItem(k, strfds+"C"+strchan+"|"+strtemp);
					    k++;
					}
				}
			}
			pTrait = pComboTrait;
		}
		m_listC.InsertColumnTrait(col+1, title, LVCFMT_LEFT, kkk, col, pTrait);
		}

    	for( int iItem = 0; iItem < 6 ; iItem++)
		{
				  m_listC.InsertItem(iItem, "通断");
				  m_listC.SetItemText(iItem, 2, str_list[iItem].strl);
		}
				  m_listC.SetItemText(0, 1, "进风瓦斯");
				  m_listC.SetItemText(1, 1, "回风瓦斯");
				  m_listC.SetItemText(2, 1, "串联通风");
				  m_listC.SetItemText(3, 1, "局扇");
				  m_listC.SetItemText(4, 1, "风筒风量");
				  m_listC.SetItemText(5, 1, "控制量通道");
}
BOOL CPage_Node_Movement::OnInitDialog()
{

	CPropertyPage::OnInitDialog();
	int PlanNo = m_pDoc->GetTimingPlanNo("ALLDAY"); 

	for(int p = 1; p <= 	_max_phase_number; p++)
	{
		m_bAvailablePhaseVector [p] = false; 
		m_EffectiveGreenTime [p]= 0;
	}

	m_CurrentNodeID =  m_pDoc->m_SelectedNodeID ;
	m_CurrentNodeNumber = m_pDoc->m_NodeNoMap [m_CurrentNodeID]->m_NodeNumber ;
	

	m_CycleLengthInSec = m_pDoc->m_NodeNoMap [m_CurrentNodeID]->m_CycleLengthInSecond ;
	// Give better margin to editors
	m_ListCtrl.SetCellMargin(1.2);
	CGridRowTraitXP* pRowTrait = new CGridRowTraitXP;  // Hao: this ponter should be delete. 
	m_ListCtrl.SetDefaultRowTrait(pRowTrait);



	m_Column_names.push_back ("Incoming Node");  //0
	m_Column_names.push_back ("Outgoing Node");   //1
	m_Column_names.push_back ("Turn Type"); //2
	m_Column_names.push_back ("Direction"); //3

	m_Column_names.push_back ("Prohibition"); //4

	m_Column_names.push_back ("Simu Total Volume"); //5
	m_Column_names.push_back ("Simu Hourly Volume"); //6
	m_Column_names.push_back ("Simu Delay (sec)"); //7

	//if(m_bSigalizedNode == true)
	//{
	//m_Column_names.push_back ("Green Start Time"); //9
	//m_Column_names.push_back ("Green End Time"); //10

	//}

	CHeaderCtrl* pHeader = m_ListCtrl.GetHeaderCtrl();
	if( pHeader!=NULL)
	{
		pHeader->ModifyStyle(HDS_BUTTONS, 0);    // disable the sorting.
	}

	//Add Columns and set headers
	for (size_t i=0;i<m_Column_names.size();i++)
	{

		CGridColumnTrait* pTrait = NULL;
		//              pTrait = new CGridColumnTraitEdit();

		if(m_Column_names[i].find ("Turn Type")!=  string::npos)
		{
			pTrait = new CGridColumnTraitEdit();
		}

		if(m_Column_names[i].find ("Direction")!=  string::npos)
		{
			pTrait = new CGridColumnTraitEdit();
		}

		if(m_Column_names[i].find ("Prohibition")!=  string::npos)
		{
			CGridColumnTraitCombo* pComboTrait = new CGridColumnTraitCombo;

			pComboTrait->SetStyle (CBS_DROPDOWNLIST);
			pComboTrait->AddItem(0, _T(""));
			pComboTrait->AddItem(0, _T("Prohibited"));

			pTrait = pComboTrait;
		}

		m_ListCtrl.InsertColumnTrait((int)i,m_Column_names.at(i).c_str(),LVCFMT_LEFT,-1,-1, pTrait);

		if(i<=10)
			m_ListCtrl.SetColumnWidth((int)i,100);
		else
			m_ListCtrl.SetColumnWidth((int)i,100);
	}


	//Add Rows

	DTANode* pNode  = m_pDoc->m_NodeNoMap [m_CurrentNodeID];

	for (unsigned int i=0;i< pNode->m_MovementDataMap[m_TimingPlanName].m_MovementVector .size();i++)
	{

		DTANodeMovement movement = pNode->m_MovementDataMap[m_TimingPlanName].m_MovementVector[i];


		CString str;
		str.Format ("%d", m_pDoc->m_NodeNoMap[movement.in_link_from_node_id]->m_NodeNumber  );  // 0: from node
		int Index = m_ListCtrl.InsertItem(LVIF_TEXT,i,str , 0, 0, 0, NULL);

		int column_index = 1;

		str.Format ("%d", m_pDoc->m_NodeNoMap[movement.out_link_to_node_id ]->m_NodeNumber ); // 1: to node
		m_ListCtrl.SetItemText(Index, column_index++,str);

		m_ListCtrl.SetItemText(Index, column_index++,m_pDoc->GetTurnString(movement.movement_turn)); //2: turn type
		m_ListCtrl.SetItemText(Index, column_index++,m_pDoc->GetTurnDirectionString( movement.movement_approach_turn)); //3: turn type

		if(movement.turning_prohibition_flag  == 1)
			str.Format ("Prohibited"); 
		else
			str.Format (""); 


		m_ListCtrl.SetItemText(Index, column_index++,str );  //4


		str.Format ("%.0f",movement.sim_turn_count   ); // 5: simulated volume
		m_ListCtrl.SetItemText(Index, column_index++,str );

		float number_of_hours = max(0.01,(m_pDoc->m_TimingPlanVector[PlanNo].end_time_in_min -  m_pDoc->m_TimingPlanVector[PlanNo].start_time_in_min )/60.0);
		float sim_turn_hourly_count = movement.sim_turn_count / number_of_hours;
		str.Format ("%.0f",sim_turn_hourly_count); // 6: simulated hourly volume
		m_ListCtrl.SetItemText(Index, column_index++,str );

		str.Format ("%.1f",movement.sim_turn_delay*60   ); // 7: simulated turn delay
		m_ListCtrl.SetItemText(Index, column_index++,str );

		str.Format ("%.1f",movement.QEM_StartTime   ); // green start time 
		m_ListCtrl.SetItemText(Index, column_index++,str );

		str.Format ("%.1f",movement.QEM_EndTime  ); // green end green time 
		m_ListCtrl.SetItemText(Index, column_index++,str );

	}


	



	UpdateData(0);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}