DIY编程器网

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 3758|回复: 1
打印 上一主题 下一主题

[UUProg] uuprog开发教程:芯片支持库维护2

[复制链接]
跳转到指定楼层
楼主
发表于 2014-12-17 06:31:04 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
这个需要操作的项目比较多,看视功能简单,其实需要处理的代码量是挺大的。

基本上每个按钮或者操作都要对应一个处理函数,响应用户的操作,首先我们的初始化一些基础数据,也就是加载的芯片库数据要填充到操作界面,方便操作。
这部分必须在OnInitDialog() 就得加载,主要就是处理各个操作选项的基本数据,这部分都是来至于芯片库的配置部分,以及芯片列表和做个简单支持量的统计。
  1. BOOL CProgDeviceManage::OnInitDialog()
  2. {
  3.         CDialog::OnInitDialog();
  4.        
  5.         // TODO: Add extra initialization here
  6.         int Count;
  7.         CString Name;

  8.         //add device list
  9.         m_cDeviceList.ResetContent();
  10.         Count = parent->m_arDeviceList.GetSize();
  11.         for (int n=0;n<Count;n++)
  12.         {
  13.         Name = parent->m_arDeviceList.GetAt(n).DeviceName;
  14.         m_cDeviceList.AddString(Name);
  15.         }

  16.         //add Device Type
  17.         m_cDeviceType.ResetContent();
  18.         Count = parent->m_arTypeList.GetSize();
  19.         for (n=0;n<Count;n++)
  20.         {
  21.         Name = parent->m_arTypeList.GetAt(n).TypeName;
  22.         m_cDeviceType.AddString(Name);
  23.         }

  24.         //add Operation Type
  25.         m_cOperationID.ResetContent();
  26.         Count = parent->m_arOperationList.GetSize();
  27.         for (n=0;n<Count;n++)
  28.         {
  29.         Name = parent->m_arOperationList.GetAt(n).TypeName;
  30.         m_cOperationID.AddString(Name);
  31.         }

  32.         //add Size Type
  33.         m_cDeviceSize.ResetContent();
  34.         Count = parent->m_arSizeList.GetSize();
  35.         for (n=0;n<Count;n++)
  36.         {
  37.         Name = parent->m_arSizeList.GetAt(n).TypeName;
  38.         m_cDeviceSize.AddString(Name);
  39.         }

  40.         //add Pin Type
  41.         m_cDevicePinCount.ResetContent();
  42.         Count = parent->m_arPinList.GetSize();
  43.         for (n=0;n<Count;n++)
  44.         {
  45.         Name = parent->m_arPinList.GetAt(n).TypeName;
  46.         m_cDevicePinCount.AddString(Name);
  47.         }

  48.         //add DataWidth Type
  49.         m_cDeviceDataWidth.ResetContent();
  50.         Count = parent->m_arDataWidthList.GetSize();
  51.         for (n=0;n<Count;n++)
  52.         {
  53.         Name = parent->m_arDataWidthList.GetAt(n).TypeName;
  54.         m_cDeviceDataWidth.AddString(Name);
  55.         }

  56.         //add Package Type
  57.         m_cDevicePackage.ResetContent();
  58.         Count = parent->m_arPackageList.GetSize();
  59.         for (n=0;n<Count;n++)
  60.         {
  61.         Name = parent->m_arPackageList.GetAt(n).TypeName;
  62.         m_cDevicePackage.AddString(Name);
  63.         }

  64.         //add VCC Type
  65.         m_cDeviceVCC.ResetContent();
  66.         Count = parent->m_arVCCList.GetSize();
  67.         for (n=0;n<Count;n++)
  68.         {
  69.         Name = parent->m_arVCCList.GetAt(n).TypeName;
  70.         m_cDeviceVCC.AddString(Name);
  71.         }

  72.         //add VPP Type
  73.         m_cDeviceVPP.ResetContent();
  74.         Count = parent->m_arVPPList.GetSize();
  75.         for (n=0;n<Count;n++)
  76.         {
  77.         Name = parent->m_arVPPList.GetAt(n).TypeName;
  78.         m_cDeviceVPP.AddString(Name);
  79.         }

  80.         //add Adapter Type
  81.         m_cDeviceAdapter.ResetContent();
  82.         Count = parent->m_arAdapterList.GetSize();
  83.         for (n=0;n<Count;n++)
  84.         {
  85.         Name = parent->m_arAdapterList.GetAt(n).TypeName;
  86.         m_cDeviceAdapter.AddString(Name);
  87.         }
  88.         CString temp;
  89.         temp.Format("*收录共%d种芯片",parent->m_arDeviceList.GetSize());
  90.         m_sDeviceCount = temp;
  91.         UpdateData(false);
  92.        
  93.         return TRUE;  // return TRUE unless you set the focus to a control
  94.                       // EXCEPTION: OCX Property Pages should return FALSE
  95. }
复制代码
每个选项都有个列表,对应的处理代码可通过上面源代码看出,同时通过数组操作,通过一个循环加载到对应的选项列表中,对数组操作不熟悉的建议先看一下该部分了。
下一节将讲解下快速搜索的实现,欢迎关注。


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
沙发
发表于 2018-12-27 21:57:07 | 只看该作者
谢谢分享支持下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|文字版|手机版|DIY编程器网 ( 桂ICP备14005565号-1 )

GMT+8, 2024-5-6 21:49 , 耗时 0.100441 秒, 24 个查询请求 , Gzip 开启.

各位嘉宾言论仅代表个人观点,非属DIY编程器网立场。

桂公网安备 45031202000115号

DIY编程器群(超员):41210778 DIY编程器

DIY编程器群1(满员):3044634 DIY编程器1

diy编程器群2:551025008 diy编程器群2

QQ:28000622;Email:libyoufer@sina.com

本站由桂林市临桂区技兴电子商务经营部独家赞助。旨在技术交流,请自觉遵守国家法律法规,一旦发现将做封号删号处理。

快速回复 返回顶部 返回列表