操作组合框编辑零件内容 [英] Manipulating combobox edit part content

查看:61
本文介绍了操作组合框编辑零件内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

温柔的人,
有人可以给我一个正确的方向吗?
有成千上万个字符串要填充的数组.因此,我认为最好有一个带有列表中成千上万个字符串的组合框,然后将其随机移动到屏幕上当前显示的数组元素上,并填充从组合框列表中选择的元素.

嗯,所有这些工作都是按设计进行的,除了一件事情-不管我做什么(我做了很多尝试),组合框始终显示编辑部分中从组合框列表中选择的最后一项,但是当我选择下一个时元素我想查看此元素的当前内容,而不是最后一个元素的内容.

天真的我以为组合框的编辑部分有一个简单的SETTEXT就可以完成这项工作.不幸的是事实并非如此.

有什么想法吗?

Gentle people,
Could somebody please give me a push in the right direction?
There is an array of hundreds of strings to be filled from a list of thousands. Hence I thought it''d be a good idea to have a single combobox with the thousands of strings in the list and move it at random onto the elements of the array currently displayed on the screen and fill the element selected from the combobox list.

Well, all of this works as designed except for one thing - no matter what I do (and I have tried a lot), the combobox always shows the last item selected from the combobox list in the edit part, but when I select the next element I want to see the current contents of this element, not that of the last one.

Naively I assumed a simple SETTEXT to the edit part of the combobox would do the job. Unfortunately it does not.

Any ideas?

推荐答案

据我所知,有两种方法可以解决此问题(我认为它们在功能上是相同的):

1.使用CB_SELECTSTRING消息
2.使用CB_FINDSTRING/CB_FINDSTRINGEXACT + CB_SETCUSEL对.

As far as I know, there''s 2 ways to go about this (I think they''re functionally identical):

1. Use the CB_SELECTSTRING message
2. Use the CB_FINDSTRING/CB_FINDSTRINGEXACT + CB_SETCUSEL pair.

SendMessage(comboHwnd, CB_SELECTSTRING, 0, (LPARAM)buffer);







or

index = SendMessage(comboHwnd, CB_FINDSTRING, -1, (LPARAM)buffer);
if (index != CB_ERR)
    SendMessage(comboHwnd, CB_SETCURSEL, index, 0);


这篇关于操作组合框编辑零件内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆