CMFCToolBarComboBoxEdit
處理BackSpace按鈕,但它不處理刪除按鈕。 除PreTranslateMessage
之外,有沒有辦法處理刪除按鈕? 如果是的話,這是什麼方式? 如果沒有,那麼我怎麼能得到控件中的當前光標位置以及如何使用其索引來移除特定的字符,這樣我就可以移除光標右側的字符(如果沒有選中)? 在此先感謝。CMFCToolBarComboBoxEdit句柄刪除按鈕
0
A
回答
1
是使用,PreTranslateMessage
。如果檢測到應處理的順序,請致電:
if (..) // Check if you have a message that should
// be passed to the window directly
{
TranslateMessage(pMsg);
DispatchMessage(pMsg);
return TRUE;
}
可以在PreTranslateMessage
始終做到這一點,當您發現該消息應該由默認的控制處理,而不應受到任何其他的控制處理在執行PreTranslateMessage
的窗口鏈中。如果您打開組合框並希望內部處理Page Down/Up而不是視圖或任何加速器,則這也很有用。
0
我已經處理了刪除鍵在PreTranslateMessage
如下:
BOOL PreTranslateMessage(MSG* pMsg)
{
if(WM_KEYDOWN == pMsg->message && VK_DELETE == pMsg->wParam)
{
int iStartChar = -1, iEndChar = -1;
GetSel(iStartChar, iEndChar);
if(iStartChar != iEndChar)
Clear(); //clear the selected text
else
{
SetSel(iStartChar, iStartChar + 1);
Clear();
}
}
return CMFCToolBarComboBoxEdit::PreTranslateMessage(pMsg);
}
+1
看看我的答案。它更通用... – xMRi
相關問題
- 1. 刪除Git句柄
- 2. QDockWidget - 刪除句柄
- 3. UITableviewcell中的句柄按鈕事件
- 4. JavaFX按鈕句柄()不調用方法
- 5. 句柄按鈕在DialogFragment中點擊
- 6. GWT回句柄,刷新,關閉按鈕
- 7. TTLauncherView刪除刪除按鈕
- 8. 刪除按鈕
- 9. 刪除按鈕
- 10. 刪除按鈕
- 11. 刪除按鈕
- 12. 刪除按鈕
- 13. 刪除按鈕
- 14. Visual Studio設計器刪除句柄
- 15. 從cURL中刪除文件句柄(CURLOPT_FILE)
- 16. Javascript按鈕刪除
- 17. cakephp刪除按鈕
- 18. Extjs,刪除按鈕
- 19. 刪除jQuery按鈕
- 20. Android刪除按鈕
- 21. PHP刪除按鈕
- 22. UITableView刪除按鈕
- 23. 按鈕被刪除
- 24. UITableView - 刪除按鈕
- 25. 按住按鈕刪除
- 26. SWT按鈕 - 刪除按鈕背景
- 27. jQuery按鈕刪除動態行按鈕
- 28. 刪除UITableViewCell無刪除按鈕?
- 29. 刪除按鈕,刪除數據庫行
- 30. 刪除按鈕,刪除多個控件
謝謝@xMRi –