combox的二次查询功能,既动态更改combox里面的内容
来源:互联网 发布:淘宝二维码怎么生成 编辑:程序博客网 时间:2024/05/21 11:07
本来以为很简单,不过实现起来,发现不少问题,至今仍没有解决的问题就是为什么combox要有自动完成功能,比如combox下的listbox有如下几条数据:ds-sdfk;dgs-dfjl中国人98;但是啦开发;dskgadfka,用户一旦输入ds,然后再单击一下combox的编辑框或者调用showdropdown函数,或者单击到其他控件上去,combox便会自动把ds-sdfk填充到combox的编辑框去,这样就影响了动态提示符合条件项目的功能!
后来虽然没有彻底解决这个问题,但想了个好办法规避这种现象!
具体代码:
void SetAllComBoxText(CComboBox* mycombox,const CStringvect& mystrvect)
{
CString str;
int ncount=mystrvect.size();
mycombox->GetWindowText(str);
mycombox->ResetContent();
mycombox->SetWindowText(str);
mycombox->ShowDropDown(TRUE);
mycombox->SetEditSel(lstrlen(str),-1);
for(CStringvect::const_iterator it=mystrvect.begin();it!=mystrvect.end();it++)
{
mycombox->AddString((*it));
}
}
void GetAllComBoxText(CComboBox* mycombox,CStringvect& mystrvect)
{
mystrvect.clear();
CString str;
int ncount=mycombox->GetCount();
for(int i=0;i<ncount;i++)
{
mycombox->GetLBText(i,str);
mystrvect.push_back(str);
}
}
void GetFindComBoxText(LPCTSTR findstr,CStringvect& findstrvect,const CStringvect& mystrvect)
{
findstrvect.clear();
for(CStringvect::const_iterator it=mystrvect.begin();it!=mystrvect.end();it++)
{
if(strnicmp(findstr,(*it),strlen(findstr))==0)
{
//ATLTRACE("查找到了");
findstrvect.push_back((*it));
}
//ATLTRACE("查找%s %s/n",findstr,(*it));
}
}
详细代码可以到
http://www.cfxy.net/dispbbs.asp?boardid=46&id=2236
或者
http://www.codeproject.com/KB/combobox/CFComboBox.aspx
下载demo版本
- combox的二次查询功能,既动态更改combox里面的内容
- 实现带查询功能的Combox控件
- WinForm中如何实现带查询功能的combox
- qt获取combox内容的知识点
- winform动态设置combox的值
- easyui combox数据的动态绑定
- Combox的数据源
- 一个自定义的Combox
- 一个自定义的Combox
- combox的总结
- progstudio Combox 的问题
- Ext的Combox
- 似曾相识的Combox
- Ext的Combox
- combox的显示
- 可多选的combox
- COMBOX的基本使用
- combox
- WiMAX技术到底是什么? 究竟何谓WiMAX?
- Data Store with ArcSDE
- WinCE安装包系统定义
- 好大一头猪
- 一些网站收藏
- combox的二次查询功能,既动态更改combox里面的内容
- 作为项目经理需要重点关注的事情
- jsf结合myfaces实现文件上传
- Wimax论坛发展大事记
- 换行符转换成
- J2EE Web服务开发系列之十二: 实现安全的AXIS Web服务,第1部分
- WindowsWorkFlow学习资源
- Mysql master slave因改变hostname导致问题及其解决办法
- c#键盘模拟