I have a windows gui built in Microsoft Visual C++ and when the user performs a certain set of actions the keyboard tabbing to move from widget to widget stops working.
Simply put, there are two list boxes with an add and a remove buttons. Selecting a row in listbox #1 and pressing the add button removes the object from list box #1 and moves it to list box #2. The problem I am seeing is that 开发者_运维技巧the keyboard tabbing functionality goes away since the tab focus was on the add button which become desensitized when the add callback is completed (since no row in list box #1 is selected currently).
I want to be able to re-set the tab focus to listbox #1 (but not the selection of a particular row). Any ways to do this? I believe I am running as a standard modal dialog.
If I understand correctly, you just want to set the focus back to one of the listboxes. Since this is in a dialog, instead of calling SetFocus
, The Old New Thing recommends you send a message to the listbox's hWnd to do this:
void SetDialogFocus(HWND hdlg, HWND hwndControl)
{
SendMessage(hdlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, TRUE);
}
精彩评论