[英]CComboBox automatically selects text after call to MoveWindow
我目前在CFormView
中使用的CComboBox
遇到了一个非常奇怪的问题。
After adding strings to the combobox (created with WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL
), I'm selecting an entry via CComboBox::SetCurSel
and resize the combobox via MoveWindow
in the OnSize()
handler of the CFormView
派生 class。
一旦我包含对MoveWindow
的调用,combobox 的编辑部分中的整个文本就会被选中。 如果我删除对MoveWindow
的调用,则不会选择文本。 这不仅适用于一个,而且适用于所有使用的组合框。
在这一点上,我不知何故迷路了。 非常感谢任何提示!
当组合框获得焦点时,选择所有文本是标准的 Windows 行为。 我猜 MoveWindow 正在重置控件上的焦点。
尝试使用 CComboBox::SetEditSel 删除 MoveWindow 之后的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.