void CBacnetProgram::Initial_List()
{
	m_program_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	//m_program_list.SetExtendedStyle(m_program_list.GetExtendedStyle() |LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES);
	m_program_list.SetExtendedStyle(m_program_list.GetExtendedStyle() |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
	m_program_list.InsertColumn(0, _T("Num"), 80, ListCtrlEx::CheckBox, LVCFMT_CENTER, ListCtrlEx::SortByDigit);
	m_program_list.InsertColumn(1, _T("Full Label"), 150, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_program_list.InsertColumn(2, _T("Status"), 100, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_program_list.InsertColumn(3, _T("Auto/Manual"), 100, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_program_list.InsertColumn(4, _T("Size"), 80, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_program_list.InsertColumn(5, _T("Run Status"), 100, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_program_list.InsertColumn(6, _T("Label"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_pragram_dlg_hwnd = this->m_hWnd;
	g_hwnd_now = m_pragram_dlg_hwnd;

	CRect list_rect,win_rect;
	m_program_list.GetWindowRect(list_rect);
	ScreenToClient(&list_rect);
	::GetWindowRect(m_pragram_dlg_hwnd,win_rect);
	m_program_list.Set_My_WindowRect(win_rect);
	m_program_list.Set_My_ListRect(list_rect);

	m_program_list.DeleteAllItems();
	for (int i=0;i<(int)m_Program_data.size();i++)
	{
		CString temp_item,temp_value,temp_cal,temp_filter,temp_status,temp_lable;
		CString temp_des;
		CString temp_units;
		temp_item.Format(_T("%d"),i+1);
		m_program_list.InsertItem(i,temp_item);
		m_program_list.SetCellEnabled(i,0,0);
		m_program_list.SetCellChecked(0,0,1);// default will set the first one checked
		if(ListCtrlEx::ComboBox == m_program_list.GetColumnType(PROGRAM_AUTO_MANUAL))
		{
			ListCtrlEx::CStrList strlist;
			strlist.push_back(Auto_Manual[0]);
			strlist.push_back(Auto_Manual[1]);
			m_program_list.SetCellStringList(i, PROGRAM_AUTO_MANUAL, strlist);
		}

		if(ListCtrlEx::ComboBox == m_program_list.GetColumnType(PROGRAM_STATUS))
		{
			ListCtrlEx::CStrList strlist;
			strlist.push_back(ProgramStatus[0]);
			strlist.push_back(ProgramStatus[1]);
			m_program_list.SetCellStringList(i, PROGRAM_STATUS, strlist);
		}

		for (int x=0;x<PROGRAM_COL_NUMBER;x++)
		{
			if((i%2)==0)
				m_program_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
			else
				m_program_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);		
		}

	}

	m_program_list.SetCellChecked(0,0,1);
}
Пример #2
0
BOOL CChildDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	//	程序报表的设置

	CRect listrect;
	m_ProList.GetWindowRect(listrect);

//	m_ProList.EnableScrollBar(SB_HORZ, ESB_ENABLE_BOTH);

//	 为列表视图控件添加全行选中和栅格风格   
    m_ProList.SetExtendedStyle(m_ProList.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); 

    // 原生类的添加函数
    //m_ProList.InsertColumn(0, _T("行号"), LVCFMT_CENTER, listrect.Width()/12, 0);   
    //m_ProList.InsertColumn(1, _T("程序指令"), LVCFMT_CENTER, listrect.Width()/6, 1);   
    //m_ProList.InsertColumn(2, _T("参数1"), LVCFMT_CENTER, listrect.Width()/6, 2);   
    //m_ProList.InsertColumn(3, _T("参数2"), LVCFMT_CENTER, listrect.Width()/6, 3);   
    //m_ProList.InsertColumn(4, _T("参数3"), LVCFMT_CENTER, listrect.Width()/6, 4);   
    //m_ProList.InsertColumn(5, _T("备注"), LVCFMT_CENTER, listrect.Width()/6, 5);

	//扩展类的添加项目函数
	m_ProList.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	m_ProList.SetExtendedStyle(m_ProList.GetExtendedStyle() |LVS_EX_FULLROWSELECT );
	//可以是  //combo,edit,checkbox,radio,progress等
	m_ProList.InsertColumn(0, _T("行号"), listrect.Width()/12, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByDigit);
	m_ProList.InsertColumn(1, _T("程序指令"), listrect.Width()/6, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);//
	m_ProList.InsertColumn(2, _T("参数1"), listrect.Width()/6, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_ProList.InsertColumn(3, _T("参数2"), listrect.Width()/6, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_ProList.InsertColumn(4, _T("参数3"), listrect.Width()/6, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
	m_ProList.InsertColumn(5, _T("备注"),listrect.Width()/6, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);

	//第0列循环设置程序行数
	int proRowsNum = 200;
	CString lineNum;
	LPCTSTR strBuf;
	for(int i = 0 ;i<proRowsNum; i++)
	{
		lineNum.Format(_T("%d"),i);
		strBuf =LPCTSTR(lineNum);
		m_ProList.InsertItem(i,strBuf);  
	}  
/*    m_ProList.SetItemText(3, 1, _T("hello"));   
    m_ProList.SetItemText(3, 2, _T("world"));  */ 

		//设置选择程序列的combobox的参数
		for (int i = 0; i <= proRowsNum - 1; i++)
		{
			CString sub;
			sub.Format(_T("程序一"));
			//LPCTSTR aa = _T("asdf");
			m_ProList.SetItemText(i, 1, sub);
			if(ListCtrlEx::ComboBox == m_ProList.GetColumnType(1))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(sub);
				CString str; 
				str.Format(_T("程序二")); 
				strlist.push_back(str);
				str.Format(_T("程序三")); 
				strlist.push_back(str);
				str.Format(_T("程序四")); 
				strlist.push_back(str);
				m_ProList.SetCellStringList(i, 1, strlist);
			}
			m_ProList.SetCellEnabled(i, 1);
		}

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Пример #3
0
void CBacnetVariable::Initial_List()
{
	m_variable_list.ShowWindow(SW_HIDE);
	m_variable_list.DeleteAllItems();
	while ( m_variable_list.DeleteColumn (0)) ;

	m_variable_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	m_variable_list.SetExtendedStyle(m_variable_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
	m_variable_list.InsertColumn(VARIABLE_NUM, _T("Variable"), 70, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	m_variable_list.InsertColumn(VARIABLE_FULL_LABLE, _T("Full Label"), 200, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_variable_list.InsertColumn(VARIABLE_AUTO_MANUAL, _T("Auto/Manual"), 150, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_variable_list.InsertColumn(VARIABLE_VALUE, _T("Value"), 120, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_variable_list.InsertColumn(VARIABLE_UNITE, _T("Units"), 120, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_variable_list.InsertColumn(VARIABLE_LABLE, _T("Label"), 130, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_variable_dlg_hwnd = this->m_hWnd;
	//g_hwnd_now = m_variable_dlg_hwnd;

	CRect list_rect,win_rect;
	m_variable_list.GetWindowRect(list_rect);
	ScreenToClient(&list_rect);
	::GetWindowRect(m_input_dlg_hwnd,win_rect);
	m_variable_list.Set_My_WindowRect(win_rect);
	m_variable_list.Set_My_ListRect(list_rect);

	CTime TimeTemp(2016,1,1,0,0,0);
	m_variable_time_picker.SetFormat(_T("HH:mm"));
	m_variable_time_picker.SetTime(&TimeTemp);
	m_variable_time_picker.ShowWindow(SW_HIDE);

	m_variable_list.DeleteAllItems();
	for (int i=0;i<(int)m_Variable_data.size();i++)
	{
		CString temp_item,temp_value,temp_cal,temp_filter,temp_status,temp_lable;
		CString temp_des;
		CString temp_units;

		if(i>=variable_item_limit_count)
			break;

		temp_item.Format(_T("VAR%d"),i+1);
		m_variable_list.InsertItem(i,temp_item);

		if(ListCtrlEx::ComboBox == m_variable_list.GetColumnType(VARIABLE_UNITE))
		{
			ListCtrlEx::CStrList strlist;

			for (int i=0;i<(int)sizeof(Units_Type)/sizeof(Units_Type[0]);i++)
			{
				strlist.push_back(Units_Type[i]);
			}
			m_variable_list.SetCellStringList(i, VARIABLE_UNITE, strlist);		
		}

		for (int x=0;x<VARIABLE_COL_NUMBER;x++)
		{
			if((i%2)==0)
				m_variable_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
			else
				m_variable_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);		
		}

	}
	m_variable_list.InitListData();
	m_variable_list.ShowWindow(SW_SHOW);
}
void CBacnetInput::Initial_List()
{
    m_input_list.ShowWindow(SW_HIDE);
	m_input_list.DeleteAllItems();
	while ( m_input_list.DeleteColumn (0)) ;

	m_input_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	//m_input_list.SetExtendedStyle(m_input_list.GetExtendedStyle() |LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES);
	m_input_list.SetExtendedStyle(m_input_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
	m_input_list.InsertColumn(INPUT_NUM, _T("Input"), 50, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	m_input_list.InsertColumn(INPUT_FULL_LABLE, _T("Full Label"), 100, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_AUTO_MANUAL, _T("Auto/Manual"), 80, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_VALUE, _T("Value"), 80, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_UNITE, _T("Units"), 80, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_RANGE, _T("Range"), 100, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_CAL, _T("Calibration"), 70, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_CAL_OPERATION, _T("Sign"), 50, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_FITLER, _T("Filter"), 60, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_DECOM, _T("Status"), 60, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_JUMPER, _T("Jumper"), 90, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_list.InsertColumn(INPUT_LABLE, _T("Label"), 80, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_input_dlg_hwnd = this->m_hWnd;
	//g_hwnd_now = m_input_dlg_hwnd;

	CRect list_rect,win_rect;
	m_input_list.GetWindowRect(list_rect);
	ScreenToClient(&list_rect);
	::GetWindowRect(m_input_dlg_hwnd,win_rect);
	m_input_list.Set_My_WindowRect(win_rect);
	m_input_list.Set_My_ListRect(list_rect);


	//m_input_list.DeleteAllItems();
	for (int i=0;i<(int)m_Input_data.size();i++)
	{
		CString temp_item,temp_value,temp_cal,temp_filter,temp_status,temp_lable;
		CString temp_des;
		CString temp_units;

		if(i>=input_item_limit_count)	//vector的大小始终不变 ,用次变量来 约束 要显示的 item 数量;
			break;

		temp_item.Format(_T("IN%d"),i+1);
		m_input_list.InsertItem(i,temp_item);



		if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
		{
			ListCtrlEx::CStrList strlist;
			for (int i=0;i<(int)sizeof(Units_Type)/sizeof(Units_Type[0]);i++)
			{
				strlist.push_back(Units_Type[i]);
			}
			m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
		}

		if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_JUMPER))
		{
			ListCtrlEx::CStrList strlist;
			for (int i=0;i<(int)sizeof(JumperStatus)/sizeof(JumperStatus[0]);i++)
			{
				strlist.push_back(JumperStatus[i]);
			}
			m_input_list.SetCellStringList(i, INPUT_JUMPER, strlist);		
		}

		//if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_DECOM))
		//{
		//	ListCtrlEx::CStrList strlist;
		//	for (int m=0;m<(int)(sizeof(Decom_Array)/sizeof(Decom_Array[0]));m++)
		//	{
		//		strlist.push_back(Decom_Array[m]);
		//	}
		//	m_input_list.SetCellStringList(i, INPUT_DECOM, strlist);
		//}

		for (int x=0;x<INPUT_COL_NUMBER;x++)
		{
			if((i%2)==0)
				m_input_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
			else
				m_input_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);		
		}

		

	}
	m_input_list.InitListData();
	 m_input_list.ShowWindow(SW_SHOW);
}
void CBacnetInput::Initial_List()
{
    m_input_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
    //m_input_list.SetExtendedStyle(m_input_list.GetExtendedStyle() |LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES);
    m_input_list.SetExtendedStyle(m_input_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
    m_input_list.InsertColumn(INPUT_NUM, _T("NUM"), 50, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByDigit);
    m_input_list.InsertColumn(INPUT_FULL_LABLE, _T("Full Label"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_AUTO_MANUAL, _T("Auto/Manual"), 80, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_VALUE, _T("Value"), 80, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_UNITE, _T("Units"), 80, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_RANGE, _T("Range"), 100, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_CAL, _T("Calibration"), 80, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_FITLER, _T("Filter"), 80, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_DECOM, _T("Status"), 80, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_list.InsertColumn(INPUT_LABLE, _T("Label"), 80, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
    m_input_dlg_hwnd = this->m_hWnd;
    g_hwnd_now = m_input_dlg_hwnd;

    CRect list_rect,win_rect;
    m_input_list.GetWindowRect(list_rect);
    ScreenToClient(&list_rect);
    ::GetWindowRect(m_input_dlg_hwnd,win_rect);
    m_input_list.Set_My_WindowRect(win_rect);
    m_input_list.Set_My_ListRect(list_rect);


    m_input_list.DeleteAllItems();
    for (int i=0; i<(int)m_Input_data.size(); i++)
    {
        CString temp_item,temp_value,temp_cal,temp_filter,temp_status,temp_lable;
        CString temp_des;
        CString temp_units;
        temp_item.Format(_T("%d"),i+1);
        m_input_list.InsertItem(i,temp_item);
        if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_AUTO_MANUAL))
        {
            ListCtrlEx::CStrList strlist;
            strlist.push_back(_T("Auto"));
            strlist.push_back(_T("Manual"));
            m_input_list.SetCellStringList(i, INPUT_AUTO_MANUAL, strlist);
        }


        if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
        {
            ListCtrlEx::CStrList strlist;
            for (int i=0; i<(int)sizeof(Units_Type)/sizeof(Units_Type[0]); i++)
            {
                strlist.push_back(Units_Type[i]);
            }
            m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);
        }



        //if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
        //{
        //	ListCtrlEx::CStrList strlist;
        //	int test = sizeof(Input_Range_Array)/sizeof(Input_Range_Array[0]);
        //	for (int loop=0;loop<(int)sizeof(Input_Range_Array)/sizeof(Input_Range_Array[0]);loop++)
        //	{
        //		strlist.push_back(Input_Range_Array[loop]) ;
        //	}
        //	m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);
        //}

        if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_FITLER))
        {
            ListCtrlEx::CStrList strlist;
            for (int m=0; m<(int)(sizeof(Input_Filter_Array)/sizeof(Input_Filter_Array[0])); m++)
            {
                strlist.push_back(Input_Filter_Array[m]);
            }
            m_input_list.SetCellStringList(i, INPUT_FITLER, strlist);
        }

        if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_DECOM))
        {
            ListCtrlEx::CStrList strlist;
            for (int m=0; m<(int)(sizeof(Decom_Array)/sizeof(Decom_Array[0])); m++)
            {
                strlist.push_back(Decom_Array[m]);
            }
            m_input_list.SetCellStringList(i, INPUT_DECOM, strlist);
        }

        for (int x=0; x<INPUT_COL_NUMBER; x++)
        {
            if((i%2)==0)
                m_input_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
            else
                m_input_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);
        }



    }
}
Пример #6
0
void CNewTstatSchedulesDlg::Fresh_List()
{
	ListCtrlEx::CStrList strlist;
	strlist.clear();
	strlist.push_back(L"");
	strlist.push_back(L"Home");
	strlist.push_back(L"Work");
	strlist.push_back(L"Sleep");
	 
	list<Schedule_Node>::iterator it;
	int index=0;
	for (it = m_ScheduleList.begin();it!=m_ScheduleList.end();++it)
	{


		CString strTime;
		int Item=index+1;
		strTime.Format(_T("%d"),Item);
		WeeeklyList.SetItemText(index,0,strTime);
		WeeeklyList.SetItemBkColor(index,0,RGB(255,255,255),0);
		strTime.Format(_T("%02d:%02d"),it->Hour,it->Minite);
		/*WeeeklyList.InsertItem(index++,L"");*/
		WeeeklyList.SetItemText(index,1,strTime);
		WeeeklyList.SetItemBkColor(index,1,RGB(255,255,255),0);
		WeeeklyList.SetWhetherShowBkCol(false);
		//设置Combox
		for (int col = 2;col<10;col++)
		{
			WeeeklyList.SetCellStringList(index, col, strlist);

		}
		WeeeklyList.SetItemText(index,2,m_strScheduleMode[it->Monday]);
		WeeeklyList.SetItemBkColor(index,2,m_COLScheduleMode[it->Monday],0);
		it->Col_Monday = m_COLScheduleMode[it->Monday];
		if (it->Monday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,2); 
			WeeeklyList.SetItemBkColor(index,2,PreviousScheduleColor,0);
			it->Col_Monday = PreviousScheduleColor;
		}
		  
		WeeeklyList.SetItemText(index,3,m_strScheduleMode[it->Tuesday]);
		WeeeklyList.SetItemBkColor(index,3,m_COLScheduleMode[it->Tuesday],0);
		
		it->Col_Tuesday = m_COLScheduleMode[it->Tuesday];
		if (it->Tuesday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,3); 
			WeeeklyList.SetItemBkColor(index,3,PreviousScheduleColor,0);
			it->Col_Tuesday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index,4,m_strScheduleMode[it->Wednesday]);
		WeeeklyList.SetItemBkColor(index,4,m_COLScheduleMode[it->Wednesday],0);

		it->Col_Wednesday = m_COLScheduleMode[it->Wednesday];
		if (it->Wednesday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,4); 
			WeeeklyList.SetItemBkColor(index,4,PreviousScheduleColor,0);
			it->Col_Wednesday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index,5,m_strScheduleMode[it->Thursday]);
		WeeeklyList.SetItemBkColor(index,5,m_COLScheduleMode[it->Thursday],0);

		it->Col_Thursday = m_COLScheduleMode[it->Thursday];
		if (it->Thursday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,5); 
			WeeeklyList.SetItemBkColor(index,5,PreviousScheduleColor,0);
			it->Col_Thursday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index,6,m_strScheduleMode[it->Friday]);
		WeeeklyList.SetItemBkColor(index,6,m_COLScheduleMode[it->Friday],0);

		it->Col_Friday = m_COLScheduleMode[it->Friday];
		if (it->Friday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,6); 
			WeeeklyList.SetItemBkColor(index,6,PreviousScheduleColor,0);
			it->Col_Friday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index,7,m_strScheduleMode[it->Saturday]);
		WeeeklyList.SetItemBkColor(index,7,m_COLScheduleMode[it->Saturday],0);

		it->Col_Saturday = m_COLScheduleMode[it->Saturday];
		if (it->Saturday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,7); 
			WeeeklyList.SetItemBkColor(index,7,PreviousScheduleColor,0);
			it->Col_Saturday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index,8,m_strScheduleMode[it->Sunday]);
		WeeeklyList.SetItemBkColor(index,8,m_COLScheduleMode[it->Sunday],0);
		it->Col_Sunday = m_COLScheduleMode[it->Sunday];
		if (it->Sunday == 0&&index!=0)
		{
			COLORREF PreviousScheduleColor=GetItemColor(index-1,8); 
			WeeeklyList.SetItemBkColor(index,8,PreviousScheduleColor,0);
			it->Col_Sunday = PreviousScheduleColor;
		}

		WeeeklyList.SetItemText(index, 9, m_strScheduleMode[it->Holiday]);
		WeeeklyList.SetItemBkColor(index, 9, m_COLScheduleMode[it->Holiday], 0);
		it->Col_Holiday = m_COLScheduleMode[it->Holiday];
		if (it->Holiday == 0 && index != 0)
		{
			COLORREF PreviousScheduleColor = GetItemColor(index - 1, 9);
			WeeeklyList.SetItemBkColor(index, 9, PreviousScheduleColor, 0);
			it->Col_Holiday = PreviousScheduleColor;
		}


		index++;
	}
}
void CBacnetInput::Reload_Unit_Type()
{

	for (int i=0;i<(int)m_Input_data.size();i++)	//Initial All first.
	{
		if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
		{
			ListCtrlEx::CStrList strlist;
			for (int i=0;i<(int)sizeof(Units_Type)/sizeof(Units_Type[0]);i++)
			{
				strlist.push_back(Units_Type[i]);
			}
			m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
		}
	}

	int initial_count = 0;
	if(bacnet_device_type == BIG_MINIPANEL)	//Special Initial
	{	
		if(BIG_MINIPANEL_IN_A > (int)m_Input_data.size()) 
			initial_count = (int)m_Input_data.size();
		else
			initial_count = BIG_MINIPANEL_IN_A;
		for (int i=0;i<initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
			}
		}
	}
	else if(bacnet_device_type == SMALL_MINIPANEL)
	{
		if(SMALL_MINIPANEL_IN_A > (int)m_Input_data.size()) 
			initial_count = (int)m_Input_data.size();
		else
			initial_count = SMALL_MINIPANEL_IN_A;
		for (int i=0;i<initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
			}
		}
	}
	else if(bacnet_device_type == TINY_MINIPANEL)
	{
		if(TINY_MINIPANEL_IN_A > (int)m_Input_data.size()) 
			initial_count = (int)m_Input_data.size();
		else
			initial_count = TINY_MINIPANEL_IN_A;
		for (int i=0;i<initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
			}
		}
	}
	else if(bacnet_device_type == PRODUCT_CM5)
	{
		int analog_count;
		int digital_count;
		if(CM5_MINIPANEL_IN_A > (int)m_Input_data.size()) 
			analog_count = (int)m_Input_data.size();
		else
			analog_count = CM5_MINIPANEL_IN_A;

		digital_count = CM5_MINIPANEL_IN_D;
		
		for (int i=0;i<analog_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
			}
		}

		for (int i=analog_count;i< (analog_count + digital_count); i++ )
		{
			if(ListCtrlEx::ComboBox == m_input_list.GetColumnType(INPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Digital_Only);
				m_input_list.SetCellStringList(i, INPUT_RANGE, strlist);		
			}
		}
		
		
	}



}
Пример #8
0
BOOL CNewTstatSchedulesDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	m_strScheduleMode[0]=L"";
	m_strScheduleMode[1]=L"Home";
	m_strScheduleMode[2]=L"Work";
	m_strScheduleMode[3]=L"Sleep";
	
	m_COLScheduleMode[0] = RGB(238, 44, 44);
	m_COLScheduleMode[1] = RGB(153, 50, 204);
	m_COLScheduleMode[2] = RGB(143, 188, 143);
	m_COLScheduleMode[3] = RGB(238, 44, 44);

	LoadSheduleDataAndColor();
	WeeeklyList.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	//m_input_list.SetExtendedStyle(m_input_list.GetExtendedStyle() |LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES);
	WeeeklyList.SetExtendedStyle(WeeeklyList.GetExtendedStyle() |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
	WeeeklyList.InsertColumn(0, _T("Item"), 40, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	WeeeklyList.InsertColumn(1, _T("Time"), 80, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	WeeeklyList.InsertColumn(2, _T("Monday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	WeeeklyList.InsertColumn(3, _T("Tuesday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(4, _T("Wednesday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(5, _T("Thursday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(6, _T("Friday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(7, _T("Saturday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(8, _T("Sunday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.InsertColumn(9, _T("Holiday"), 80, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	WeeeklyList.SetBkColor(RGB(205,201,201)) ;
	
	 
	g_hwnd_now = this->m_hWnd;
	
	ListCtrlEx::CStrList strlist;
	strlist.clear();
	strlist.push_back(L"");
	strlist.push_back(L"Home");
	strlist.push_back(L"Work");
	strlist.push_back(L"Sleep");
	list<Schedule_Node>::iterator it;
	int index=0;
	for (it = m_ScheduleList.begin();it!=m_ScheduleList.end();++it)
	{
		 
		 
		CString strTime;
		int Item=index+1;
		strTime.Format(_T("%d"),Item);
		WeeeklyList.InsertItem(index,strTime);
		strTime.Format(_T("%02d:%02d"),it->Hour,it->Minite);
		WeeeklyList.SetItemBkColor(index,0,RGB(255,255,255),0);
		WeeeklyList.SetItemText(index,1,strTime);
		WeeeklyList.SetItemBkColor(index,1,RGB(255,255,255),0);
		WeeeklyList.SetWhetherShowBkCol(false);
		//设置Combox
		for (int col = 2;col<10;col++)
		{
			WeeeklyList.SetCellStringList(index, col, strlist);
		}
		WeeeklyList.SetItemText(index,2,m_strScheduleMode[it->Monday]);
		WeeeklyList.SetItemBkColor(index,2,it->Col_Monday,0);
		WeeeklyList.SetItemText(index,3,m_strScheduleMode[it->Tuesday]);
		WeeeklyList.SetItemBkColor(index,3,it->Col_Tuesday,0);
		WeeeklyList.SetItemText(index,4,m_strScheduleMode[it->Wednesday]);
		WeeeklyList.SetItemBkColor(index,4,it->Col_Wednesday,0);
		WeeeklyList.SetItemText(index,5,m_strScheduleMode[it->Thursday]);
		WeeeklyList.SetItemBkColor(index,5,it->Col_Thursday,0);
		WeeeklyList.SetItemText(index,6,m_strScheduleMode[it->Friday]);
		WeeeklyList.SetItemBkColor(index,6,it->Col_Friday,0);
		WeeeklyList.SetItemText(index,7,m_strScheduleMode[it->Saturday]);
		WeeeklyList.SetItemBkColor(index,7,it->Col_Saturday,0);
		WeeeklyList.SetItemText(index,8,m_strScheduleMode[it->Sunday]);
		WeeeklyList.SetItemBkColor(index,8,it->Col_Sunday,0);
		WeeeklyList.SetItemText(index, 9, m_strScheduleMode[it->Holiday]);
		WeeeklyList.SetItemBkColor(index, 9, it->Col_Holiday, 0);

		index++;
	 
	}
	
	if (product_register_value[MODBUS_SCHEDULE_ON_OFF] == 1)
	{
		 
			((CButton *)GetDlgItem(IDC_CHECK_ENABLE_SCHEDULE))->SetCheck(1);
	}
	else
	{

		   ((CButton *)GetDlgItem(IDC_CHECK_ENABLE_SCHEDULE))->SetCheck(0);
	}
	
	WeeeklyList.GetFocus();
	return FALSE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void CTStatOutputView::Initial_Combox_Show_Tstat(){
    if (ListCtrlEx::ComboBox == m_output_list.GetColumnType(TStat_Range))
    {
        if ((product_register_value[7] == PM_TSTAT6)||(product_register_value[7] == PM_TSTAT7)||(product_register_value[7] == PM_TSTAT8)||(product_register_value[7] == PM_TSTAT5i)
			|| (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V)
			){
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if (lRow<5)
                {

                    for (int aaa=0;aaa<(int)sizeof(OUTPUT_RANGE45)/sizeof(OUTPUT_RANGE45[0]);aaa++)
                    {
                        strlist.push_back(OUTPUT_RANGE45[aaa]);
                    }

                }
                else{

                    for (int aaa=0;aaa<5;aaa++)
                    {
                        strlist.push_back(OUTPUT_ANRANGE6[aaa]);
                    }

                }

                m_output_list.SetCellStringList(lRow, TStat_Range, strlist);
            }
        }
        else if (product_register_value[7]==1||product_register_value[7]==2||product_register_value[7]==3){
            for (int lRow=0;lRow<5;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if (lRow<3)
                {


                    for(int i=0;i<3;i++)//2.5.0.98
                    {

                        strlist.push_back(OUTPUT_RANGE5[i]);
                    }

                } 
                else
                {     
                    if (m_tstat_output_data.at(lRow).Function.RegValue==4)
                    {
                        for(int i=5;i<8;i++)//2.5.0.98
                        {
                            strlist.push_back(OUTPUT_ANRANGE[i]);
                        }
                    }
                    else
                    {
                        for(int i=0;i<4;i++)//2.5.0.98
                        {
                            strlist.push_back(OUTPUT_ANRANGE[i]);
                        }
                    }

                }
                m_output_list.SetCellStringList(lRow, TStat_Range, strlist);
            }
        }
        else if (product_register_value[7]==4||product_register_value[7]==12||product_register_value[7]==17||product_register_value[7]==18){

            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if (lRow<5)
                {
                    for(int i=0;i<3;i++)//2.5.0.98
                    {
                        strlist.push_back(OUTPUT_RANGE5[i]);
                    }
                } 
                else 
                {
                    if (lRow<7)
                    {
                        if (m_tstat_output_data.at(lRow).Function.RegValue==4)//Transducer
                        {
                            for(int i=5;i<10;i++)//2.5.0.98
                            {
                                strlist.push_back(OUTPUT_ANRANGE[i]);
                            }
                        }
                        else
                        {
                            for(int i=0;i<5;i++)//2.5.0.98
                            {
                                strlist.push_back(OUTPUT_ANRANGE[i]);
                            }
                        }

                    }
                    else
                        return;
                }
                m_output_list.SetCellStringList(lRow, TStat_Range, strlist);
            }
        }else if (product_register_value[7]==PM_TSTAT5E||product_register_value[7]==PM_PM5E || product_register_value[7] == PM_PM5E_ARM ||(product_register_value[7]==PM_TSTATRUNAR)){
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if (lRow<5)
                {
                    for(int i=0;i<3;i++)//2.5.0.98
                    {
                        strlist.push_back(OUTPUT_RANGE5[i]);
                    }
                } 
                else 
                {
                    if (lRow<7)
                    {
                        if (m_tstat_output_data.at(lRow).Function.RegValue==4)//Transducer
                        {
                            for(int i=5;i<15;i++)//2.5.0.98
                            {
                                strlist.push_back(OUTPUT_ANRANGE[i]);
                            }
                        }
                        else
                        {
                            for(int i=0;i<5;i++)//2.5.0.98
                            {
                                strlist.push_back(OUTPUT_ANRANGE[i]);
                            }
                        }

                    }
                    else
                        return;
                }
                m_output_list.SetCellStringList(lRow, TStat_Range, strlist);
            }
        }
    }

    if (ListCtrlEx::ComboBox == m_output_list.GetColumnType(TStat_Funcation))
    {
        if ((product_register_value[7] == PM_TSTAT6)||(product_register_value[7] == PM_TSTAT7)||(product_register_value[7] == PM_TSTAT8)||(product_register_value[7] == PM_TSTAT5i)
			|| (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V)
			)
        {
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if (lRow<5)
                {
                    for(int i=0;i<3;i++)//2.5.0.98
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);

                    }
                }
                else
                {
                    for(int i=0;i<5;i++)//2.5.0.98
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);
                        //AfxMessageBox(ONTPUT_FUNS[i]);
                    }
                }

                m_output_list.SetCellStringList(lRow, TStat_Funcation, strlist);
            }
        }
        else
        {
#if 1//2.5.0.98
            int m_nModeType=product_register_value[7];
            if (m_nModeType==2||m_nModeType==3||m_nModeType==1)
            {
                for (int lRow=0;lRow<5;lRow++)
                {
                    ListCtrlEx::CStrList strlist;
                    strlist.clear();
                    if(lRow<3)
                    {
                        for(int i=0;i<4;i++)
                        {
                            strlist.push_back(ONTPUT_FUNS[i]);
                        }    
                    }
                    else if(lRow<5)
                    {

                        for(int i=0;i<5;i++)
                        {
                            strlist.push_back(ONTPUT_FUNS[i]);

                        }

                    }
                    else
                    {
                        return;
                    }
                    m_output_list.SetCellStringList(lRow, TStat_Funcation, strlist);
                }
            } 
            else
            {
                for (int lRow=0;lRow<7;lRow++)
                {
                    ListCtrlEx::CStrList strlist;
                    strlist.clear();

                    if(lRow<5)
                    {

                        for(int i=0;i<4;i++)
                        {
                            strlist.push_back(ONTPUT_FUNS[i]);
                        }

                    }
                    else
                    {

                        for(int i=0;i<5;i++) 
                        {
                            strlist.push_back(ONTPUT_FUNS[i]);
                        }

                    }
                    m_output_list.SetCellStringList(lRow, TStat_Funcation, strlist);
                }
            }

#endif
        }
    }

    if (ListCtrlEx::ComboBox == m_output_list.GetColumnType(TStat_Interlock)){
        int m_nModeType=product_register_value[7];
        if ((product_register_value[7] == PM_TSTAT6)||(product_register_value[7] == PM_TSTAT7)||(product_register_value[7] == PM_TSTAT8)||(product_register_value[7] == PM_TSTAT5i)
			|| (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V)
			)
        {
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                for(int i=0;i<6;i++)
                {
                    strlist.push_back(Interlock[i]);
                    //AfxMessageBox(ONTPUT_FUNS[i]);
                }
                m_output_list.SetCellStringList(lRow, TStat_Interlock, strlist);

            }
        }
#if 1//2.5.0.98
        else if (m_nModeType==2||m_nModeType==3||m_nModeType==1)
        {
            for (int lRow=0;lRow<5;lRow++){
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if(lRow<3)
                {

                    for(int i=0;i<4;i++)
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);
                    }
                }
                else if(lRow<5)
                {

                    for(int i=0;i<5;i++)
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);

                    }

                }
                else
                {
                    return;
                }
                m_output_list.SetCellStringList(lRow, TStat_Interlock, strlist);
            }


        } 
        else
        {
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                if(lRow<5)
                {

                    for(int i=0;i<4;i++)
                        //for(int i=0;i<3;i++)//2.5.0.98
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);

                    }

                }
                else
                {

                    for(int i=0;i<5;i++)
                        //for(int i=0;i<3;i++)//2.5.0.98
                    {
                        strlist.push_back(ONTPUT_FUNS[i]);

                    }

                }
                m_output_list.SetCellStringList(lRow, TStat_Interlock, strlist);
            }
        }

#endif
    }

    if (ListCtrlEx::ComboBox == m_output_list.GetColumnType(TStat_Signal_Type)){
        if ((product_register_value[7] == PM_TSTAT6)||(product_register_value[7] == PM_TSTAT7)||(product_register_value[7] == PM_TSTAT8)
			|| (product_register_value[7] == PM_TSTAT8_WIFI) || (product_register_value[7] == PM_TSTAT8_OCC) || (product_register_value[7] == PM_TSTAT7_ARM) || (product_register_value[7] == PM_TSTAT8_220V)
			||(product_register_value[7] == PM_TSTAT5i))
        {
            for (int lRow=0;lRow<7;lRow++)
            {
                ListCtrlEx::CStrList strlist;
                strlist.clear();
                for(int i=5;i<17;i++)//2.5.0.98
                {
                    strlist.push_back(OUTPUT_ANRANGE[i]);
                }
                m_output_list.SetCellStringList(lRow, TStat_Signal_Type, strlist);

            }
        }
    }

}
void CTStatOutputView::Initial_ListFor_Tstat(){
    m_output_list.ShowWindow(SW_HIDE);
    m_output_list.DeleteAllItems();
    while ( m_output_list.DeleteColumn (0)) ;

    if (product_type==CS3000)
    {
        m_output_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
        m_output_list.SetExtendedStyle(m_output_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
        m_output_list.InsertColumn(OUTPUT_NUM, _T("NUM"), 40, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByDigit);
        m_output_list.InsertColumn(TStat_OutputName, _T("Full Label"), 140, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_AM, _T("Input Type"), 80, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Value, _T("Min"), 60, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Unit, _T("Max"), 60, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Range, _T("Signal"), 80, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
        // 		m_output_list.InsertColumn(TStat_Funcation, _T("Function"), 60, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        // 		m_output_list.InsertColumn(TStat_Interlock, _T("Interlock"), 60, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        // 		m_output_list.InsertColumn(TStat_OFFON_Delay, _T("OFF->ON Delay"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        // 		m_output_list.InsertColumn(TStat_ONOFF_Delay, _T("ON->OFF Delay"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        // 		m_output_list.InsertColumn(TStat_Signal_Type, _T("Signal Type"), 70, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        CString strTemp;
        //m_input_list.DeleteAllItems();
        for (int i=0;i<m_tstat_output_data.size();i++)
        {
            strTemp.Format(_T("%d"),i+1);
            m_output_list.InsertItem(i,strTemp); 
        }
        if (ListCtrlEx::ComboBox == m_output_list.GetColumnType(TStat_AM))
        {
            ListCtrlEx::CStrList strlist;
            strlist.clear();
            strlist.push_back(_T("Current"));
            strlist.push_back(_T("Voltage"));
            m_output_list.SetCellStringList(0, TStat_AM, strlist);
        }
    }
    else if(product_type == T3000_6_ADDRESS){
        m_output_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
        m_output_list.SetExtendedStyle(m_output_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
        m_output_list.InsertColumn(OUTPUT_NUM, _T("NUM"), 40, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByDigit);
        m_output_list.InsertColumn(TStat_OutputName, _T("Full Label"), 140, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_AM, _T("Auto/Manual"), 80, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Value, _T("Value"), 60, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Unit, _T("Units"), 60, ListCtrlEx::Normal, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Range, _T("Range"), 80, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Funcation, _T("Function"), 60, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Interlock, _T("Interlock"), 60, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_OFFON_Delay, _T("OFF->ON Delay"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_ONOFF_Delay, _T("ON->OFF Delay"), 100, ListCtrlEx::EditBox, LVCFMT_CENTER, ListCtrlEx::SortByString);
        m_output_list.InsertColumn(TStat_Signal_Type, _T("Signal Type"), 70, ListCtrlEx::ComboBox, LVCFMT_CENTER, ListCtrlEx::SortByString);

        CString strTemp;
        //m_input_list.DeleteAllItems();
        for (int i=0;i<m_tstat_output_data.size();i++)
        {
            strTemp.Format(_T("%d"),i+1);
            m_output_list.InsertItem(i,strTemp);
            for (int x=0;x<OUTPUT_COL_NUMBER;x++)
            {
                if((i%2)==0)
                    m_output_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
                else
                    m_output_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);		
            }
        }


        Initial_Combox_Show_Tstat();
    }
    else{}
    g_hwnd_now = this->m_hWnd;
   
    m_output_list.ShowWindow(SW_SHOW);
}
void CBacnetOutput::Initial_List()
{

	m_output_list.ShowWindow(SW_HIDE);
	m_output_list.DeleteAllItems();
	while ( m_output_list.DeleteColumn (0)) ;

	m_output_list.ModifyStyle(0, LVS_SINGLESEL|LVS_REPORT|LVS_SHOWSELALWAYS);
	m_output_list.SetExtendedStyle(m_output_list.GetExtendedStyle()  |LVS_EX_GRIDLINES&(~LVS_EX_FULLROWSELECT));//Not allow full row select.
	m_output_list.InsertColumn(OUTPUT_NUM, _T("Output"), 60, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	m_output_list.InsertColumn(OUTPUT_PANEL, _T("Panel"), 40, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByDigit);
	m_output_list.InsertColumn(OUTPUT_FULL_LABLE, _T("Full Label"), 140, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_AUTO_MANUAL, _T("Auto/Manual"), 80, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_HW_SWITCH, _T("HOA Switch"), 80, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_VALUE, _T("Value"), 80, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_UNITE, _T("Units"), 80, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_RANGE, _T("Range"), 100, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	//m_output_list.InsertColumn(OUTPUT_0_PERSENT, _T("0%"), 60, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	//m_output_list.InsertColumn(OUTPUT_100_PERSENT, _T("100%"), 60, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_PWM_PERIOD, _T("PWM\r\n Period"), 80, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	
	m_output_list.InsertColumn(OUTPUT_DECOM, _T("Status"), 70, ListCtrlEx::ComboBox, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_LABLE, _T("Label"), 70, ListCtrlEx::EditBox, LVCFMT_LEFT, ListCtrlEx::SortByString);

	m_output_list.InsertColumn(OUTPUT_EXTERNAL, _T("External"), 0, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_PRODUCT, _T("Product Name"), 0, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);
	m_output_list.InsertColumn(OUTPUT_EXT_NUMBER, _T("Product Output"), 0, ListCtrlEx::Normal, LVCFMT_LEFT, ListCtrlEx::SortByString);


	m_output_dlg_hwnd = this->m_hWnd;
	//g_hwnd_now = m_output_dlg_hwnd;
	m_output_list.GetClientRect(Output_rect);
 
	for (int i=0;i<(int)m_Output_data.size();i++)
	{
		CString temp_item,temp_value,temp_cal,temp_filter,temp_status,temp_lable;
		CString temp_des;
		CString temp_units;


		if(i>=output_item_limit_count)
			break;

		temp_item.Format(_T("OUT%d"),i+1);
		m_output_list.InsertItem(i,temp_item);


		if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
		{
			ListCtrlEx::CStrList strlist;
			for (int aaa=0;aaa<(int)sizeof(Units_Type)/sizeof(Units_Type[0]);aaa++)
			{
				strlist.push_back(Units_Type[aaa]);
			}
			m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
		}

		if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_DECOM))
		{
			ListCtrlEx::CStrList strlist;
			for (int m=0;m<(int)(sizeof(Output_Decom_Array)/sizeof(Output_Decom_Array[0]));m++)
			{
				strlist.push_back(Output_Decom_Array[m]);
			}
			m_output_list.SetCellStringList(i, OUTPUT_DECOM, strlist);
		}

		for (int x=0;x<OUTPUT_COL_NUMBER;x++)
		{
			if((i%2)==0)
				m_output_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR);
			else
				m_output_list.SetItemBkColor(i,x,LIST_ITEM_DEFAULT_BKCOLOR_GRAY);		
		}

	}
	m_output_list.InitListData();
	m_output_list.ShowWindow(SW_SHOW);
}
void CBacnetOutput::Reload_Unit_Type()
{
	 

	for (int i=0;i<(int)m_Output_data.size();i++)	//Initial All first.
	{
		if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
		{
			ListCtrlEx::CStrList strlist;
			for (int i=0;i<(int)sizeof(Units_Type)/sizeof(Units_Type[0]);i++)
			{
				strlist.push_back(Units_Type[i]);
			}
			m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
		}
	}

	int d_initial_count = 0;
	int a_initial_count = 0;
	if(bacnet_device_type == BIG_MINIPANEL)	//Special Initial
	{	
		#ifdef NEED_ANALOG_DIGITAL_ONLY
		if(BIG_MINIPANEL_OUT_D > (int)m_Output_data.size()) 
			d_initial_count = (int)m_Output_data.size();
		else
			d_initial_count = BIG_MINIPANEL_OUT_D;

		a_initial_count = BIG_MINIPANEL_OUT_A;
		for (int i=0;i<d_initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Digital_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}

		for (int i=d_initial_count;i< (d_initial_count + a_initial_count);i++ )
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}
		#endif
		m_output_list.SetColumnWidth(OUTPUT_HW_SWITCH,80);
	}
	else if(bacnet_device_type == SMALL_MINIPANEL)
	{
		#ifdef NEED_ANALOG_DIGITAL_ONLY
		if(SMALL_MINIPANEL_OUT_D > (int)m_Output_data.size()) 
			d_initial_count = (int)m_Output_data.size();
		else
			d_initial_count = SMALL_MINIPANEL_OUT_D;

		a_initial_count = SMALL_MINIPANEL_OUT_A;
		for (int i=0;i<d_initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Digital_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}

		for (int i=d_initial_count;i< (d_initial_count + a_initial_count);i++ )
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}
		#endif
		m_output_list.SetColumnWidth(OUTPUT_HW_SWITCH,80);
	}
	else if(bacnet_device_type == TINY_MINIPANEL)
	{
#ifdef NEED_ANALOG_DIGITAL_ONLY
		if(TINY_MINIPANEL_OUT_D > (int)m_Output_data.size()) 
			d_initial_count = (int)m_Output_data.size();
		else
			d_initial_count = TINY_MINIPANEL_OUT_D;

		a_initial_count = TINY_MINIPANEL_OUT_A;
		for (int i=0;i<d_initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Digital_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}

		for (int i=d_initial_count;i< (d_initial_count + a_initial_count);i++ )
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Analog_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}
#endif
		m_output_list.SetColumnWidth(OUTPUT_HW_SWITCH,80);
	}
	else if(bacnet_device_type == PRODUCT_CM5)
	{
		#ifdef NEED_ANALOG_DIGITAL_ONLY
		d_initial_count = CM5_MINIPANEL_OUT_D;
		for (int i=0;i<d_initial_count;i++)
		{
			if(ListCtrlEx::ComboBox == m_output_list.GetColumnType(OUTPUT_RANGE))
			{
				ListCtrlEx::CStrList strlist;
				strlist.push_back(Units_Digital_Only);
				m_output_list.SetCellStringList(i, OUTPUT_RANGE, strlist);		
			}
		}
		#endif
		m_output_list.SetColumnWidth(OUTPUT_HW_SWITCH,0);
	}

}