[英]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.