uuprog开发教程:芯片支持库维护2
这个需要操作的项目比较多,看视功能简单,其实需要处理的代码量是挺大的。基本上每个按钮或者操作都要对应一个处理函数,响应用户的操作,首先我们的初始化一些基础数据,也就是加载的芯片库数据要填充到操作界面,方便操作。
这部分必须在OnInitDialog() 就得加载,主要就是处理各个操作选项的基本数据,这部分都是来至于芯片库的配置部分,以及芯片列表和做个简单支持量的统计。
BOOL CProgDeviceManage::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int Count;
CString Name;
//add device list
m_cDeviceList.ResetContent();
Count = parent->m_arDeviceList.GetSize();
for (int n=0;n<Count;n++)
{
Name = parent->m_arDeviceList.GetAt(n).DeviceName;
m_cDeviceList.AddString(Name);
}
//add Device Type
m_cDeviceType.ResetContent();
Count = parent->m_arTypeList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arTypeList.GetAt(n).TypeName;
m_cDeviceType.AddString(Name);
}
//add Operation Type
m_cOperationID.ResetContent();
Count = parent->m_arOperationList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arOperationList.GetAt(n).TypeName;
m_cOperationID.AddString(Name);
}
//add Size Type
m_cDeviceSize.ResetContent();
Count = parent->m_arSizeList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arSizeList.GetAt(n).TypeName;
m_cDeviceSize.AddString(Name);
}
//add Pin Type
m_cDevicePinCount.ResetContent();
Count = parent->m_arPinList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arPinList.GetAt(n).TypeName;
m_cDevicePinCount.AddString(Name);
}
//add DataWidth Type
m_cDeviceDataWidth.ResetContent();
Count = parent->m_arDataWidthList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arDataWidthList.GetAt(n).TypeName;
m_cDeviceDataWidth.AddString(Name);
}
//add Package Type
m_cDevicePackage.ResetContent();
Count = parent->m_arPackageList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arPackageList.GetAt(n).TypeName;
m_cDevicePackage.AddString(Name);
}
//add VCC Type
m_cDeviceVCC.ResetContent();
Count = parent->m_arVCCList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arVCCList.GetAt(n).TypeName;
m_cDeviceVCC.AddString(Name);
}
//add VPP Type
m_cDeviceVPP.ResetContent();
Count = parent->m_arVPPList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arVPPList.GetAt(n).TypeName;
m_cDeviceVPP.AddString(Name);
}
//add Adapter Type
m_cDeviceAdapter.ResetContent();
Count = parent->m_arAdapterList.GetSize();
for (n=0;n<Count;n++)
{
Name = parent->m_arAdapterList.GetAt(n).TypeName;
m_cDeviceAdapter.AddString(Name);
}
CString temp;
temp.Format("*收录共%d种芯片",parent->m_arDeviceList.GetSize());
m_sDeviceCount = temp;
UpdateData(false);
return TRUE;// return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}每个选项都有个列表,对应的处理代码可通过上面源代码看出,同时通过数组操作,通过一个循环加载到对应的选项列表中,对数组操作不熟悉的建议先看一下该部分了。
下一节将讲解下快速搜索的实现,欢迎关注。
谢谢分享支持下
页:
[1]