在 Delphi 7 上保留 ComboBox 的问题
我刚刚注意到 ComboBox 组件的奇怪行为。我以 DropDownList 样式使用它。如果我点击它,它会像往常一样下拉项目列表。但是,如果我单击表单上的某些其他组件,组合框将不会让我离开它,除非我选择其中一项。我想过添加 onmouseleave 事件,但在这种情况下,即使我将鼠标移出组合框区域一点,它也会关闭,这是不可取的。我希望看到的是,每当我单击其区域之外的某个位置时,组合框就会失去焦点。这可能吗?
I have just noticed a strange behavior of ComboBox component. I am using it in DropDownList style. If I click on it, it drops down the list of items, as usual. But then if I click on some other component on the form, the combobox will not let me leave it, unless I select one of the items. I thought of adding onmouseleave event, but in that case it would close even if I move mouse out of combobox area a little, which is undesirable. What I would like to see is combobox losing focus whenever i click somewhere outside of its area. Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,我只是做了你所做的事情:启动一个新应用程序并抛出 ComboBox 和 TEdit。运行程序。正如您单击它时所说的那样,它会从列表中下拉。另外,当我单击 TEdit 时,组合框会按预期自动关闭。所以,我不知道你的程序有什么问题。
Actually, I just did what you did: started a new application and threw ComboBox and TEdit. Ran the program. It drops down the list just as you said when you clicked on it. Also, when I clicked on the TEdit, the combobox closed automatically as expected. So, I don't know what is the problem with your program.